forked from ihepta/vscode-extension-case-search
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
alwaysShow, choices/cases do not disappear canSelectMany, multiple choices/cases are possible -> remove @ALL choice save/restore selected cases remove all @ Use removeDuplicates + join instead of reduce Some tests
- Loading branch information
Showing
5 changed files
with
127 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,7 @@ | |
## 0.0.4 | ||
|
||
- fix: Chinese be transformed to empty. | ||
|
||
## 0.0.5 | ||
|
||
- feat: can select multiple cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,49 @@ | ||
import * as assert from 'assert'; | ||
|
||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
import * as vscode from 'vscode'; | ||
// import * as myExtension from '../../extension'; | ||
|
||
import { exportedForTesting } from '../../extension'; | ||
const { kebabCaseQPI, camelCaseQPI, pascalCaseQPI, snakeCaseQPI, snakeUpperCaseQPI } = exportedForTesting; | ||
const { transformQuery2RegExp, buildRegexQuery } = exportedForTesting; | ||
|
||
|
||
suite('Extension Test Suite', () => { | ||
vscode.window.showInformationMessage('Start all tests.'); | ||
|
||
test('Sample test', () => { | ||
assert.strictEqual(-1, [1, 2, 3].indexOf(5)); | ||
assert.strictEqual(-1, [1, 2, 3].indexOf(0)); | ||
test('transformQuery2RegExp', () => { | ||
assert.strictEqual("one-two-three-four", transformQuery2RegExp("oneTwoThreeFour", "kebab-case")); | ||
assert.strictEqual("one-two-three-four", transformQuery2RegExp("one two_three-Four", "kebab-case")); | ||
assert.strictEqual("oneTwoThreeFour", transformQuery2RegExp("oneTwoThreeFour", "camelCase")); | ||
assert.strictEqual("oneTwoThreeFour", transformQuery2RegExp("one two_three-Four", "camelCase")); | ||
assert.strictEqual("OneTwoThreeFour", transformQuery2RegExp("oneTwoThreeFour", "PascalCase")); | ||
assert.strictEqual("OneTwoThreeFour", transformQuery2RegExp("one two_three-Four", "PascalCase")); | ||
assert.strictEqual("one_two_three_four", transformQuery2RegExp("oneTwoThreeFour", "snake_case")); | ||
assert.strictEqual("one_two_three_four", transformQuery2RegExp("one two_three-Four", "snake_case")); | ||
assert.strictEqual("ONE_TWO_THREE_FOUR", transformQuery2RegExp("oneTwoThreeFour", "UPPER_SNAKE_CASE")); | ||
assert.strictEqual("ONE_TWO_THREE_FOUR", transformQuery2RegExp("one two_three-Four", "UPPER_SNAKE_CASE")); | ||
}); | ||
|
||
test('buildRegexQuery', () => { | ||
const query = "one two_three-Four"; | ||
|
||
assert.strictEqual("", buildRegexQuery(query, [])); | ||
|
||
assert.strictEqual("one-two-three-four", buildRegexQuery(query, [kebabCaseQPI])); | ||
assert.strictEqual("oneTwoThreeFour", buildRegexQuery(query, [camelCaseQPI])); | ||
assert.strictEqual("OneTwoThreeFour", buildRegexQuery(query, [pascalCaseQPI])); | ||
assert.strictEqual("one_two_three_four", buildRegexQuery(query, [snakeCaseQPI])); | ||
assert.strictEqual("ONE_TWO_THREE_FOUR", buildRegexQuery(query, [snakeUpperCaseQPI])); | ||
|
||
assert.strictEqual("one-two-three-four|oneTwoThreeFour", | ||
buildRegexQuery(query, [kebabCaseQPI, camelCaseQPI])); | ||
|
||
assert.strictEqual("OneTwoThreeFour|one_two_three_four|ONE_TWO_THREE_FOUR", | ||
buildRegexQuery(query, [pascalCaseQPI, snakeCaseQPI, snakeUpperCaseQPI])); | ||
|
||
assert.strictEqual("OneTwoThreeFour|one_two_three_four|ONE_TWO_THREE_FOUR|oneTwoThreeFour|one-two-three-four", | ||
buildRegexQuery(query, [pascalCaseQPI, snakeCaseQPI, snakeUpperCaseQPI, camelCaseQPI, kebabCaseQPI])); | ||
|
||
// Duplicates are removed | ||
assert.strictEqual("OneTwoThreeFour|ONE_TWO_THREE_FOUR", | ||
buildRegexQuery(query, [pascalCaseQPI,snakeUpperCaseQPI,pascalCaseQPI])); | ||
}); | ||
}); |