aboutsummaryrefslogtreecommitdiff
path: root/plugin/test
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/test')
-rw-r--r--plugin/test/highlighting.test.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugin/test/highlighting.test.js b/plugin/test/highlighting.test.js
index 89e031a..24751bf 100644
--- a/plugin/test/highlighting.test.js
+++ b/plugin/test/highlighting.test.js
@@ -36,7 +36,7 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil
['X <- TRUE', 'TRUE', 'constant.language'],
['X <- 12.5', '12.5', 'constant.numeric'],
['X <- 2 DIV 1', 'DIV', 'keyword.operator.word'],
- ['X <- 1', '<-', 'keyword.operator'],
+ ['X <- 1', '<-', 'keyword.operator.assignment.cpp'],
['OUTPUT "text"', 'text', 'string.quoted.double'],
["X <- 'A'", 'A', 'string.quoted.single']
]) assert.ok(scopesAt(text, word).some(s => s.startsWith(scope)), text);
@@ -46,6 +46,13 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil
}
});
+test('both assignment characters share the C++ assignment scope', () => {
+ const text = 'X <- 1';
+ assert.deepEqual(scopesAt(text, '<-'), scopesAt(text, '-'));
+ assert.ok(!scopesAt('X < 1', '<').includes('keyword.operator.assignment.cpp'));
+ assert.ok(!scopesAt('X - 1', '-').includes('keyword.operator.assignment.cpp'));
+});
+
test('comments, strings, lowercase and keyword prefixes cannot become keywords', () => {
assert.ok(scopesAt('// IF [(', 'IF').some(s => s.startsWith('comment.')));
assert.ok(scopesAt('OUTPUT "IF // ["', 'IF').some(s => s.startsWith('string.')));