|
5 | 5 |
|
6 | 6 | import { expect } from 'chai';
|
7 | 7 |
|
8 |
| -import { DECREASE_INDENT_REGEX, INCREASE_INDENT_REGEX, MULTILINE_SEPARATOR_INDENT_REGEX, OUTDENT_ONENTER_REGEX } from '../../client/language/languageConfiguration'; |
| 8 | +import { MULTILINE_SEPARATOR_INDENT_REGEX } from '../../client/language/languageConfiguration'; |
9 | 9 |
|
10 | 10 | suite('Language configuration regexes', () => {
|
11 | 11 | test('Multiline separator indent regex should not pick up strings with no multiline separator', async () => {
|
12 | 12 | const result = MULTILINE_SEPARATOR_INDENT_REGEX.test('a = "test"');
|
13 |
| - expect(result).to.be.equal(false, 'Multiline separator indent regex for regular strings should not have matches'); |
| 13 | + expect (result).to.be.equal(false, 'Multiline separator indent regex for regular strings should not have matches'); |
14 | 14 | });
|
15 |
| - |
16 | 15 | test('Multiline separator indent regex should not pick up strings with escaped characters', async () => {
|
17 | 16 | const result = MULTILINE_SEPARATOR_INDENT_REGEX.test('a = \'hello \\n\'');
|
18 |
| - expect(result).to.be.equal(false, 'Multiline separator indent regex for strings with escaped characters should not have matches'); |
| 17 | + expect (result).to.be.equal(false, 'Multiline separator indent regex for strings with escaped characters should not have matches'); |
19 | 18 | });
|
20 |
| - |
21 | 19 | test('Multiline separator indent regex should pick up strings ending with a multiline separator', async () => {
|
22 | 20 | const result = MULTILINE_SEPARATOR_INDENT_REGEX.test('a = \'multiline \\');
|
23 |
| - expect(result).to.be.equal(true, 'Multiline separator indent regex for strings with newline separator should have matches'); |
24 |
| - }); |
25 |
| - |
26 |
| - [ |
27 |
| - 'async def test(self):', |
28 |
| - 'class TestClass:', |
29 |
| - 'def foo(self, node, namespace=""):', |
30 |
| - 'for item in items:', |
31 |
| - 'if foo is None:', |
32 |
| - 'try:', |
33 |
| - 'while \'::\' in macaddress:', |
34 |
| - 'with self.test:' |
35 |
| - ].forEach(example => { |
36 |
| - const keyword = example.split(' ')[0]; |
37 |
| - |
38 |
| - test(`Increase indent regex should pick up lines containing the ${keyword} keyword`, async () => { |
39 |
| - const result = INCREASE_INDENT_REGEX.test(example); |
40 |
| - expect(result).to.be.equal(true, `Increase indent regex should pick up lines containing the ${keyword} keyword`); |
41 |
| - }); |
42 |
| - |
43 |
| - test(`Decrease indent regex should not pick up lines containing the ${keyword} keyword`, async () => { |
44 |
| - const result = DECREASE_INDENT_REGEX.test(example); |
45 |
| - expect(result).to.be.equal(false, `Decrease indent regex should not pick up lines containing the ${keyword} keyword`); |
46 |
| - }); |
47 |
| - }); |
48 |
| - |
49 |
| - ['elif x < 5:', 'else:', 'except TestError:', 'finally:'].forEach(example => { |
50 |
| - const keyword = example.split(' ')[0]; |
51 |
| - |
52 |
| - test(`Increase indent regex should pick up lines containing the ${keyword} keyword`, async () => { |
53 |
| - const result = INCREASE_INDENT_REGEX.test(example); |
54 |
| - expect(result).to.be.equal(true, `Increase indent regex should pick up lines containing the ${keyword} keyword`); |
55 |
| - }); |
56 |
| - |
57 |
| - test(`Decrease indent regex should pick up lines containing the ${keyword} keyword`, async () => { |
58 |
| - const result = DECREASE_INDENT_REGEX.test(example); |
59 |
| - expect(result).to.be.equal(true, `Decrease indent regex should pick up lines containing the ${keyword} keyword`); |
60 |
| - }); |
61 |
| - }); |
62 |
| - |
63 |
| - test('Increase indent regex should not pick up lines without keywords', async () => { |
64 |
| - const result = INCREASE_INDENT_REGEX.test('a = \'hello \\n \''); |
65 |
| - expect(result).to.be.equal(false, 'Increase indent regex should not pick up lines without keywords'); |
66 |
| - }); |
67 |
| - |
68 |
| - test('Decrease indent regex should not pick up lines without keywords', async () => { |
69 |
| - const result = DECREASE_INDENT_REGEX.test('a = \'hello \\n \''); |
70 |
| - expect(result).to.be.equal(false, 'Decrease indent regex should not pick up lines without keywords'); |
71 |
| - }); |
72 |
| - |
73 |
| - [' break', '\t\t continue', ' pass', 'raise Exception(\'Unknown Exception\'', ' return [ True, False, False ]'].forEach(example => { |
74 |
| - const keyword = example.trim().split(' ')[0]; |
75 |
| - |
76 |
| - const testWithoutComments = `Outdent regex for on enter rule should pick up lines containing the ${keyword} keyword`; |
77 |
| - test(testWithoutComments, () => { |
78 |
| - const result = OUTDENT_ONENTER_REGEX.test(example); |
79 |
| - expect(result).to.be.equal(true, testWithoutComments); |
80 |
| - }); |
81 |
| - |
82 |
| - const testWithComments = `Outdent regex on enter should pick up lines containing the ${keyword} keyword and ending with comments`; |
83 |
| - test(testWithComments, () => { |
84 |
| - const result = OUTDENT_ONENTER_REGEX.test(`${example} # test comment`); |
85 |
| - expect(result).to.be.equal(true, testWithComments); |
86 |
| - }); |
| 21 | + expect (result).to.be.equal(true, 'Multiline separator indent regex for strings with newline separator should have matches'); |
87 | 22 | });
|
88 | 23 | });
|
0 commit comments