|
| 1 | +const { assert, expect } = require('chai'); |
| 2 | +const shared = require('../shared.js'); |
| 3 | + |
| 4 | +describe('', () => { |
| 5 | + let statement = `get first qttFoo |
| 6 | + no-lock.`; |
| 7 | + let expectedTokens = [ |
| 8 | + [ |
| 9 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get' |
| 10 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 11 | + { "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first' |
| 12 | + { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' ' |
| 13 | + { "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] } // 'qttFoo' |
| 14 | + ], |
| 15 | + [ |
| 16 | + { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 17 | + { "startIndex": 4, "endIndex": 11, "scopes": ["source.abl", "keyword.other.abl"] }, // 'no-lock' |
| 18 | + { "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 19 | + ] |
| 20 | + ]; |
| 21 | + shared.itShouldMatchExpectedScopes(statement, expectedTokens); |
| 22 | +}) |
| 23 | + |
| 24 | +describe('', () => { |
| 25 | + let statement = `get first qttFoo. |
| 26 | +
|
| 27 | +if available(ttFoo) then |
| 28 | +do: |
| 29 | +end.`; |
| 30 | + let expectedTokens = [ |
| 31 | + [ |
| 32 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get' |
| 33 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 34 | + { "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first' |
| 35 | + { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' ' |
| 36 | + { "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo' |
| 37 | + { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 38 | + ], |
| 39 | + [ |
| 40 | + { "startIndex": 0, "endIndex": 1, "scopes": ["source.abl"] } // '' |
| 41 | + ], |
| 42 | + [ |
| 43 | + { "startIndex": 0, "endIndex": 2, "scopes": ["source.abl", "keyword.other.abl"] }, // 'if' |
| 44 | + { "startIndex": 2, "endIndex": 3, "scopes": ["source.abl", "meta.function-call.abl"] }, // ' ' |
| 45 | + { "startIndex": 3, "endIndex": 12, "scopes": ["source.abl", "meta.function-call.abl", "support.function.abl"] }, // 'available' |
| 46 | + { "startIndex": 12, "endIndex": 13, "scopes": ["source.abl", "meta.function-call.abl", "meta.function.arguments.abl", "meta.brace.round.js"] }, // '(' |
| 47 | + { "startIndex": 13, "endIndex": 18, "scopes": ["source.abl", "meta.function-call.abl", "meta.function.arguments.abl", "variable.other.abl"] }, // 'ttFoo' |
| 48 | + { "startIndex": 18, "endIndex": 19, "scopes": ["source.abl", "meta.function-call.abl", "meta.brace.round.js"] }, // ')' |
| 49 | + { "startIndex": 19, "endIndex": 20, "scopes": ["source.abl"] }, // ' ' |
| 50 | + { "startIndex": 20, "endIndex": 24, "scopes": ["source.abl", "keyword.other.abl"] } // 'then' |
| 51 | + ], |
| 52 | + [ |
| 53 | + { "startIndex": 0, "endIndex": 2, "scopes": ["source.abl", "meta.block.abl", "keyword.other.abl"] }, // 'do' |
| 54 | + { "startIndex": 2, "endIndex": 3, "scopes": ["source.abl", "punctuation.terminator.abl"] } // ':' |
| 55 | + ], |
| 56 | + [ |
| 57 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'end' |
| 58 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 59 | + ] |
| 60 | + ]; |
| 61 | + shared.itShouldMatchExpectedScopes(statement, expectedTokens); |
| 62 | +}) |
| 63 | + |
| 64 | +describe('', () => { |
| 65 | + let statement = `get first qttFoo /* all foos by bar squared */ |
| 66 | + no-lock.`; |
| 67 | + let expectedTokens = [ |
| 68 | + [ |
| 69 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get' |
| 70 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 71 | + { "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first' |
| 72 | + { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' ' |
| 73 | + { "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo' |
| 74 | + { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl"] }, // ' ' |
| 75 | + { "startIndex": 17, "endIndex": 19, "scopes": ["source.abl", "comment.block.source.abl"] }, // '/*' |
| 76 | + { "startIndex": 19, "endIndex": 44, "scopes": ["source.abl", "comment.block.source.abl", "comment"] }, // ' all foos by bar squared ' |
| 77 | + { "startIndex": 44, "endIndex": 46, "scopes": ["source.abl", "comment.block.source.abl"] } // '*/' |
| 78 | + ], |
| 79 | + [ |
| 80 | + { "startIndex": 0, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 81 | + { "startIndex": 4, "endIndex": 11, "scopes": ["source.abl", "keyword.other.abl"] }, // 'no-lock' |
| 82 | + { "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 83 | + ] |
| 84 | + ]; |
| 85 | + shared.itShouldMatchExpectedScopes(statement, expectedTokens); |
| 86 | +}) |
| 87 | + |
| 88 | +describe('', () => { |
| 89 | + let statement = `get first qttFoo // excludes single bars |
| 90 | + exclusive-lock.`; |
| 91 | + let expectedTokens = [ |
| 92 | + [ |
| 93 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get' |
| 94 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 95 | + { "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first' |
| 96 | + { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' ' |
| 97 | + { "startIndex": 10, "endIndex": 16, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo' |
| 98 | + { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl"] }, // ' ' |
| 99 | + { "startIndex": 17, "endIndex": 40, "scopes": ["source.abl", "comment.line.double-slash.abl"] } // '// excludes single bars' |
| 100 | + ], |
| 101 | + [ |
| 102 | + { "startIndex": 0, "endIndex": 2, "scopes": ["source.abl"] }, // ' ' |
| 103 | + { "startIndex": 2, "endIndex": 16, "scopes": ["source.abl", "keyword.other.abl"] }, // 'exclusive-lock' |
| 104 | + { "startIndex": 16, "endIndex": 17, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 105 | + ] |
| 106 | + ]; |
| 107 | + shared.itShouldMatchExpectedScopes(statement, expectedTokens); |
| 108 | +}) |
| 109 | + |
| 110 | +describe('', () => { |
| 111 | + let statement = `get first {&BROWSE-NAME}.`; |
| 112 | + let expectedTokens = [ |
| 113 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get' |
| 114 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 115 | + { "startIndex": 4, "endIndex": 9, "scopes": ["source.abl", "keyword.other.abl"] }, // 'first' |
| 116 | + { "startIndex": 9, "endIndex": 10, "scopes": ["source.abl"] }, // ' ' |
| 117 | + { "startIndex": 10, "endIndex": 11, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.section.abl"] }, // '{' |
| 118 | + { "startIndex": 11, "endIndex": 12, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.definition.preprocessor.abl"] }, // '&' |
| 119 | + { "startIndex": 12, "endIndex": 23, "scopes": ["source.abl", "meta.preprocessor.abl", "entity.name.function.preprocessor.abl"] }, // 'BROWSE-NAME' |
| 120 | + { "startIndex": 23, "endIndex": 24, "scopes": ["source.abl", "meta.preprocessor.abl", "punctuation.section.abl"] }, // '}' |
| 121 | + { "startIndex": 24, "endIndex": 25, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 122 | + ]; |
| 123 | + shared.itShouldMatchExpectedScopes(statement, expectedTokens); |
| 124 | +}) |
| 125 | + |
| 126 | +describe('', () => { |
| 127 | + let statement = `get last qttFoo.`; |
| 128 | + let expectedTokens = [ |
| 129 | + { "startIndex": 0, "endIndex": 3, "scopes": ["source.abl", "keyword.other.abl"] }, // 'get' |
| 130 | + { "startIndex": 3, "endIndex": 4, "scopes": ["source.abl"] }, // ' ' |
| 131 | + { "startIndex": 4, "endIndex": 8, "scopes": ["source.abl", "keyword.other.abl"] }, // 'last' |
| 132 | + { "startIndex": 8, "endIndex": 9, "scopes": ["source.abl"] }, // ' ' |
| 133 | + { "startIndex": 9, "endIndex": 15, "scopes": ["source.abl", "variable.other.abl"] }, // 'qttFoo' |
| 134 | + { "startIndex": 15, "endIndex": 16, "scopes": ["source.abl", "punctuation.terminator.abl"] } // '.' |
| 135 | + ]; |
| 136 | + shared.itShouldMatchExpectedScopes(statement, expectedTokens); |
| 137 | +}) |
0 commit comments