Skip to content

Commit

Permalink
Minor tests refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
alygin authored and lemmy committed Apr 5, 2021
1 parent 5257f9f commit 97ad23a
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 77 deletions.
4 changes: 2 additions & 2 deletions tests/suite/completions/cfgCompletions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ suite('Cfg Completions Provider Test Suite', () => {

test('Completes on new line', () => {
return assertCompletions(doc, [
'{i}'
'${i}'
], true);
});

test('Doesn\'t complete in the middle of a line', () => {
return assertCompletions(doc, [
'CONSTANTS Foo, B{a}'
'CONSTANTS Foo, B${a}'
], false);
});
});
Expand Down
18 changes: 9 additions & 9 deletions tests/suite/completions/tlaCompletions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,55 +33,55 @@ suite('TLA Completions Provider Test Suite', () => {

test('Completes all but operators on new line', () => {
return assertCompletions(doc, [
'{i}'
'${i}'
], EXPECT_STARTING_KEYWORDS | EXPECT_INNER_CLASS);
});

test('Treats step numbers as new line in proof block', () => {
return assertCompletions(doc, [
'<1>. {t}'
'<1>. ${t}'
], EXPECT_PROOF_STARTING_KEYWORDS | EXPECT_INNER_CLASS);
});

test('Treats subsection numbers as new line in proof block', () => {
return assertCompletions(doc, [
'<12>.4 {t}'
'<12>.4 ${t}'
], EXPECT_PROOF_STARTING_KEYWORDS | EXPECT_INNER_CLASS);
});

test('Reckognizes letters in proof step numbers', () => {
return assertCompletions(doc, [
'<8>.a {t}'
'<8>.a ${t}'
], EXPECT_PROOF_STARTING_KEYWORDS | EXPECT_INNER_CLASS);
});

test('Completes all but operators after /\\', () => {
return assertCompletions(doc, [
'Foo == /\\{a}'
'Foo == /\\${a}'
], EXPECT_INNER_CLASS);
});

test('Completes only operators after \\', () => {
return assertCompletions(doc, [
'\\{i}'
'\\${i}'
], EXPECT_OPERATORS);
});

test('Completes only operators after \\ followed by symbols', () => {
return assertCompletions(doc, [
'\\e{q}'
'\\e${q}'
], EXPECT_OPERATORS);
});

test('Completes all but operators after \\ followed by a space', () => {
return assertCompletions(doc, [
'\\ e{q}'
'\\ e${q}'
], EXPECT_INNER_CLASS);
});

test('Completes std modules after EXTENDS', () => {
return assertCompletions(doc, [
'EXTENDS {r}'
'EXTENDS ${r}'
], EXPECT_STD_MODULES);
});
});
Expand Down
18 changes: 9 additions & 9 deletions tests/suite/declarations/tlaDeclarations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ suite('TLA Declarations Provider Test Suite', () => {
return assertDeclarations(doc, [
'---- MODULE foo ----',
'Foo == TRUE',
'Bar == Fo{o}',
'Bar == Fo${o}',
'===='
], [
loc(doc.uri, pos(1, 0))
Expand All @@ -28,7 +28,7 @@ suite('TLA Declarations Provider Test Suite', () => {
test('Ignores symbols that go after the current position', () => {
return assertDeclarations(doc, [
'---- MODULE foo ----',
'Bar == Fo{o}',
'Bar == Fo${o}',
'Foo == TRUE',
'===='
], []);
Expand All @@ -38,7 +38,7 @@ suite('TLA Declarations Provider Test Suite', () => {
return assertDeclarations(doc, [
'---- MODULE foo ----',
'/* foo',
'F{o}o == TRUE',
'F${o}o == TRUE',
'===='
], [
loc(doc.uri, pos(2, 0))
Expand All @@ -50,7 +50,7 @@ suite('TLA Declarations Provider Test Suite', () => {
'---- MODULE foo ----',
'CONSTANTS Foo',
'Foo(x) == x + 1',
'Bar == {F}oo',
'Bar == ${F}oo',
'===='
], [
loc(doc.uri, pos(1, 10)),
Expand All @@ -62,7 +62,7 @@ suite('TLA Declarations Provider Test Suite', () => {
return assertDeclarations(doc, [
'---- MODULE foo ----',
'VARIABLES bar',
"Next == /\ b{a}r' = bar + 1",
"Next == /\ b${a}r' = bar + 1",
'===='
], [
loc(doc.uri, pos(1, 10))
Expand All @@ -78,7 +78,7 @@ suite('TLA Declarations Provider Test Suite', () => {
' Foo == TRUE',
'end define',
'begin',
' x := F{o}o',
' x := F${o}o',
'end algorithm; *)',
'===='
], [
Expand All @@ -93,7 +93,7 @@ suite('TLA Declarations Provider Test Suite', () => {
'(*--algorithm foo',
'variables x',
'begin',
' x := F{o}o',
' x := F${o}o',
'end algorithm; *)',
'===='
], [
Expand All @@ -107,9 +107,9 @@ suite('TLA Declarations Provider Test Suite', () => {
'(*--algorithm foo',
'variables xyz',
'begin',
' x := F{o}o',
' x := Foo',
'end algorithm; *)',
'Foo == UNCHANGED x{y}z',
'Foo == UNCHANGED x${y}z',
'===='
], []);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function parseDocInfo(lines: string[]): DocInfo {
let n = 0;
const clearLines = lines.map(line => {
let eLine = line;
const matches = /^(.*){(\w+)}(.*)$/g.exec(line);
const matches = /^(.*)\${(\w+)}(.*)$/g.exec(line);
if (matches) {
char = matches[2] === 'enter' ? '\n' : matches[2];
position = new vscode.Position(n, matches[1].length);
Expand Down
10 changes: 5 additions & 5 deletions tests/suite/formatters/cfg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ suite('Config On Type Formatting Test Suite', () => {
test('Indents constants-block body', () => {
return assertCfgOnTypeFormatting(doc, [
'CONSTANTS',
'{enter}'
'${enter}'
], [
'CONSTANTS',
' '
Expand All @@ -29,7 +29,7 @@ suite('Config On Type Formatting Test Suite', () => {
test('Indents invariants-block body', () => {
return assertCfgOnTypeFormatting(doc, [
'INVARIANTS',
'{enter}EverythingIsCorrect'
'${enter}EverythingIsCorrect'
], [
'INVARIANTS',
' EverythingIsCorrect'
Expand All @@ -40,7 +40,7 @@ suite('Config On Type Formatting Test Suite', () => {
test('Indents properties-block body', () => {
return assertCfgOnTypeFormatting(doc, [
'PROPERTIES',
'{enter}(**)'
'${enter}(**)'
], [
'PROPERTIES',
' (**)'
Expand All @@ -51,7 +51,7 @@ suite('Config On Type Formatting Test Suite', () => {
test('Indents constraints-block body', () => {
return assertCfgOnTypeFormatting(doc, [
'CONSTRAINTS',
'{enter}'
'${enter}'
], [
'CONSTRAINTS',
' '
Expand All @@ -62,7 +62,7 @@ suite('Config On Type Formatting Test Suite', () => {
test('Doesn\'t indent if the block already has contents', () => {
return assertCfgOnTypeFormatting(doc, [
'CONSTANTS Foo = 3',
'{enter}'
'${enter}'
], [
'CONSTANTS Foo = 3',
''
Expand Down
Loading

0 comments on commit 97ad23a

Please sign in to comment.