Skip to content

Commit e3f7341

Browse files
authored
chore: test naming (#81)
* fix: W-8095488 (ternary without space gets treated as optional chaining) * test: ternary space stuff * chore: test file naming
1 parent 5f48a46 commit e3f7341

25 files changed

+52
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"watch": "tsc -w -p .",
4040
"test:soql-tmgrammar": "vscode-tmgrammar-test -g \"./grammars/soql.tmLanguage\" \"./test/soql/*.soql\" ",
4141
"test:soql-tmgrammar-snapshots": "vscode-tmgrammar-snap -s source.soql -g \"./grammars/soql.tmLanguage\" \"./test/soql/snapshots/*.soql\" ",
42-
"test": "npm run compile && mocha out/test/**/*.tests.js && npm run test:soql-tmgrammar && npm run test:soql-tmgrammar-snapshots",
42+
"test": "npm run compile && mocha out/test/**/*.test.js && npm run test:soql-tmgrammar && npm run test:soql-tmgrammar-snapshots",
4343
"prepare": "npm run build",
4444
"format": "prettier --config .prettierrc.json --write './**/*.{ts,js,json,md}'"
4545
},
File renamed without changes.
File renamed without changes.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,57 @@ Object newPoint = new Vector(point.x * z, 0);`);
235235
Token.Punctuation.Semicolon,
236236
]);
237237
});
238+
239+
it('ternary with decimal literal without spaces (W-8095488)', async () => {
240+
const input = Input.InMethod(`Decimal d = b?.34:0;`);
241+
const tokens = await tokenize(input);
242+
243+
tokens.should.deep.equal([
244+
Token.PrimitiveType.Decimal,
245+
Token.Identifiers.LocalName('d'),
246+
Token.Operators.Assignment,
247+
Token.Variables.ReadWrite('b'),
248+
Token.Operators.Conditional.QuestionMark,
249+
Token.Literals.Numeric.Decimal('34'),
250+
Token.Operators.Conditional.Colon,
251+
Token.Literals.Numeric.Decimal('0'),
252+
Token.Punctuation.Semicolon,
253+
]);
254+
});
255+
256+
it('ternary with decimal literal with leading digits (W-8095488)', async () => {
257+
const input = Input.InMethod(`Decimal i = b?.123:0;`);
258+
const tokens = await tokenize(input);
259+
260+
tokens.should.deep.equal([
261+
Token.PrimitiveType.Decimal,
262+
Token.Identifiers.LocalName('i'),
263+
Token.Operators.Assignment,
264+
Token.Variables.ReadWrite('b'),
265+
Token.Operators.Conditional.QuestionMark,
266+
Token.Literals.Numeric.Decimal('123'),
267+
Token.Operators.Conditional.Colon,
268+
Token.Literals.Numeric.Decimal('0'),
269+
Token.Punctuation.Semicolon,
270+
]);
271+
});
272+
273+
it('ternary with decimal literal with spaces (W-8095488)', async () => {
274+
const input = Input.InMethod(`Decimal d = b ? .34 : 0;`);
275+
const tokens = await tokenize(input);
276+
277+
tokens.should.deep.equal([
278+
Token.PrimitiveType.Decimal,
279+
Token.Identifiers.LocalName('d'),
280+
Token.Operators.Assignment,
281+
Token.Variables.ReadWrite('b'),
282+
Token.Operators.Conditional.QuestionMark,
283+
Token.Literals.Numeric.Decimal('34'),
284+
Token.Operators.Conditional.Colon,
285+
Token.Literals.Numeric.Decimal('0'),
286+
Token.Punctuation.Semicolon,
287+
]);
288+
});
238289
});
239290

240291
describe('Element Access', () => {
File renamed without changes.

0 commit comments

Comments
 (0)