-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
142 additions
and
31 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* This is some sample code | ||
*/ | ||
|
||
export const regExpPath = /(\w+\/)+/g; | ||
export const regExpPath2 = /(\w+[/\\])+/g; | ||
|
||
export const comment = 'This is a comment string'; |
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
25 changes: 25 additions & 0 deletions
25
packages/cspell-grammar/src/__snapshots__/app.test.ts.snap
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`app app TypeScript/sample1.ts 1`] = ` | ||
"File: sample1.ts Parser: typescript | ||
3-4 ↩︎ comment.block.documentation.ts code.ts source.ts | ||
4-32 * This is some sample code↩︎ comment.block.documentation.ts code.ts source.ts | ||
32-33 comment.block.documentation.ts code.ts source.ts | ||
50-60 regExpPath identifier code.ts source.ts | ||
64-65 ( regexp.ts code.ts source.ts | ||
65-67 \\\\w escape.regexp.ts regexp.ts code.ts source.ts | ||
67-68 + regexp.ts code.ts source.ts | ||
68-70 \\\\/ escape.regexp.ts regexp.ts code.ts source.ts | ||
70-72 )+ regexp.ts code.ts source.ts | ||
89-100 regExpPath2 identifier code.ts source.ts | ||
104-105 ( regexp.ts code.ts source.ts | ||
105-107 \\\\w escape.regexp.ts regexp.ts code.ts source.ts | ||
107-108 + regexp.ts code.ts source.ts | ||
108-109 [ brace.regexp.ts regexp.ts code.ts source.ts | ||
109-110 / character-class.regexp.ts brace.regexp.ts regexp.ts code.ts source.ts | ||
110-112 \\\\\\\\ escape.regexp.ts character-class.regexp.ts brace.regexp.ts regexp.ts code.ts source.ts | ||
112-113 ] brace.regexp.ts regexp.ts code.ts source.ts | ||
113-115 )+ regexp.ts code.ts source.ts | ||
133-140 comment identifier code.ts source.ts | ||
144-168 This is a comment string string.quoted.single.ts code.ts source.ts" | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as path from 'path'; | ||
import { run } from './app'; | ||
|
||
describe('app', () => { | ||
test.each` | ||
filename | ||
${'TypeScript/sample1.ts'} | ||
`('app $filename', async ({ filename }) => { | ||
const log = jest.spyOn(console, 'log').mockImplementation(); | ||
await run(['', '', r(filename)]); | ||
expect(log.mock.calls.map((c) => c.join(';')).join('\n')).toMatchSnapshot(); | ||
log.mockRestore(); | ||
}); | ||
}); | ||
|
||
function r(file: string): string { | ||
return path.resolve(path.join(__dirname, '..', 'fixtures'), file); | ||
} |
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
32 changes: 27 additions & 5 deletions
32
packages/cspell-grammar/src/parsers/typescript/__snapshots__/index.test.ts.snap
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,26 +1,48 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`TypeScript Parser parse sample 1`] = ` | ||
exports[`TypeScript Parser parse TypeScript/escape-codes.ts 1`] = ` | ||
"filename: TypeScript/escape-codes.ts | ||
parsed: | ||
0-5 \\"const\\" keyword.typescript.ts code.ts source.ts | ||
6-12 \\"places\\" identifier code.ts source.ts | ||
17-26 \\"Amsterdam\\" string.quoted.single.ts code.ts code.ts meta.brace.ts code.ts source.ts | ||
30-40 \\"Orléans\\" string.quoted.single.ts code.ts code.ts meta.brace.ts code.ts source.ts | ||
45-50 \\"const\\" keyword.typescript.ts code.ts source.ts | ||
51-57 \\"sample\\" identifier code.ts source.ts | ||
66-70 \\"text\\" identifier code.ts code.ts meta.brace.ts code.ts source.ts | ||
73-162 \\"Fingerspitzengefühl is a German term.\\\\nIt’s pronounced as follows: [ˈfɪŋɐˌʃpɪtsənɡəˌfyːl]\\" string.quoted.single.ts code.ts code.ts meta.brace.ts code.ts source.ts | ||
169-172 \\"hex\\" identifier code.ts code.ts meta.brace.ts code.ts source.ts | ||
175-557 \\"Fingerspitzengefühl is a German term.\\\\nIt’s pronounced as follows: [ˈfɪŋɐˌʃpɪtsənɡəˌfyːl]\\" string.quoted.single.ts code.ts code.ts meta.brace.ts code.ts source.ts | ||
564-569 \\"mixed\\" identifier code.ts code.ts meta.brace.ts code.ts source.ts | ||
572-731 \\"Fingerspitzengefühl is a German term.\\\\nIt’s pronounced as follows: [ˈfɪŋɐˌʃpɪtsənɡəˌfyːl]\\" string.quoted.single.ts code.ts code.ts meta.brace.ts code.ts source.ts | ||
738-745 \\"console\\" keyword.lib.ts code.ts source.ts | ||
745-749 \\".log\\" identifier code.ts source.ts | ||
750-756 \\"places\\" identifier code.ts code.ts meta.brace.ts code.ts source.ts | ||
759-766 \\"console\\" keyword.lib.ts code.ts source.ts | ||
766-770 \\".log\\" identifier code.ts source.ts | ||
772-774 \\"%o\\" string.quoted.single.ts code.ts code.ts meta.brace.ts code.ts source.ts | ||
777-783 \\"sample\\" identifier code.ts code.ts meta.brace.ts code.ts source.ts | ||
" | ||
`; | ||
|
||
exports[`TypeScript Parser parse TypeScript/sample1.ts 1`] = ` | ||
"filename: TypeScript/sample1.ts | ||
parsed: | ||
3-4 \\"\\\\n\\" comment.block.documentation.ts code.ts source.ts | ||
4-32 \\" * This is some sample code\\\\n\\" comment.block.documentation.ts code.ts source.ts | ||
32-33 \\" \\" comment.block.documentation.ts code.ts source.ts | ||
50-60 \\"regExpPath\\" identifier code.ts source.ts | ||
64-65 \\"(\\" regexp.ts code.ts source.ts | ||
65-67 \\"\\\\\\\\w\\" escape.regexp.ts regexp.ts code.ts source.ts | ||
67-68 \\"+\\" regexp.ts code.ts source.ts | ||
68-70 \\"\\\\\\\\/\\" escape.regexp.ts regexp.ts code.ts source.ts | ||
70-72 \\")+\\" regexp.ts code.ts source.ts | ||
89-100 \\"regExpPath2\\" identifier code.ts source.ts | ||
104-105 \\"(\\" regexp.ts code.ts source.ts | ||
105-107 \\"\\\\\\\\w\\" escape.regexp.ts regexp.ts code.ts source.ts | ||
107-108 \\"+\\" regexp.ts code.ts source.ts | ||
108-109 \\"[\\" brace.regexp.ts regexp.ts code.ts source.ts | ||
109-110 \\"/\\" character-class.regexp.ts brace.regexp.ts regexp.ts code.ts source.ts | ||
110-112 \\"\\\\\\\\\\\\\\\\\\" escape.regexp.ts character-class.regexp.ts brace.regexp.ts regexp.ts code.ts source.ts | ||
112-113 \\"]\\" brace.regexp.ts regexp.ts code.ts source.ts | ||
113-115 \\")+\\" regexp.ts code.ts source.ts | ||
133-140 \\"comment\\" identifier code.ts source.ts | ||
144-168 \\"This is a comment string\\" string.quoted.single.ts code.ts source.ts | ||
" | ||
`; |
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