@@ -16,7 +16,7 @@ describe("Grammar Tests", function() {
16
16
17
17
it("test/builtins/builtins1.py",
18
18
function() {
19
- tokens = grammar.tokenizeLines("AttributeError ConnectionAbortedError\nPendingDeprecationWarning\nModuleNotFoundError\nSystemExit\nNotImplemented True None False Ellipsis\nWarning\nException BaseException\nsum oct abs type object print")
19
+ tokens = grammar.tokenizeLines("AttributeError ConnectionAbortedError\nPendingDeprecationWarning\nModuleNotFoundError\nSystemExit\nNotImplemented True None False Ellipsis\nWarning\nException BaseException\nsum oct abs type object print exec ")
20
20
expect(tokens[0][0].value).toBe("AttributeError");
21
21
expect(tokens[0][0].scopes).toEqual(["source.python","support.type.exception.python"]);
22
22
expect(tokens[0][1].value).toBe(" ");
@@ -77,6 +77,10 @@ describe("Grammar Tests", function() {
77
77
expect(tokens[7][9].scopes).toEqual(["source.python"]);
78
78
expect(tokens[7][10].value).toBe("print");
79
79
expect(tokens[7][10].scopes).toEqual(["source.python","support.function.builtin.python"]);
80
+ expect(tokens[7][11].value).toBe(" ");
81
+ expect(tokens[7][11].scopes).toEqual(["source.python"]);
82
+ expect(tokens[7][12].value).toBe("exec");
83
+ expect(tokens[7][12].scopes).toEqual(["source.python","support.function.builtin.python"]);
80
84
});
81
85
82
86
it("test/builtins/builtins2.py",
@@ -491,6 +495,25 @@ describe("Grammar Tests", function() {
491
495
expect(tokens[5][1].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
492
496
});
493
497
498
+ it("test/builtins/builtins6.py",
499
+ function() {
500
+ tokens = grammar.tokenizeLines("exec()\nexec(code_obj)")
501
+ expect(tokens[0][0].value).toBe("exec");
502
+ expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
503
+ expect(tokens[0][1].value).toBe("(");
504
+ expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
505
+ expect(tokens[0][2].value).toBe(")");
506
+ expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
507
+ expect(tokens[1][0].value).toBe("exec");
508
+ expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
509
+ expect(tokens[1][1].value).toBe("(");
510
+ expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
511
+ expect(tokens[1][2].value).toBe("code_obj");
512
+ expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
513
+ expect(tokens[1][3].value).toBe(")");
514
+ expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
515
+ });
516
+
494
517
it("test/calls/call1.py",
495
518
function() {
496
519
tokens = grammar.tokenizeLines("some_call(A, b, c[1], *args, FOO=lambda:{'q': 42}, **kwargs)")
@@ -13243,6 +13266,41 @@ describe("Grammar Tests", function() {
13243
13266
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
13244
13267
});
13245
13268
13269
+ it("test/strings/format16.py",
13270
+ function() {
13271
+ tokens = grammar.tokenizeLines("a = b'%b' % b'foo'")
13272
+ expect(tokens[0][0].value).toBe("a");
13273
+ expect(tokens[0][0].scopes).toEqual(["source.python"]);
13274
+ expect(tokens[0][1].value).toBe(" ");
13275
+ expect(tokens[0][1].scopes).toEqual(["source.python"]);
13276
+ expect(tokens[0][2].value).toBe("=");
13277
+ expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
13278
+ expect(tokens[0][3].value).toBe(" ");
13279
+ expect(tokens[0][3].scopes).toEqual(["source.python"]);
13280
+ expect(tokens[0][4].value).toBe("b");
13281
+ expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
13282
+ expect(tokens[0][5].value).toBe("'");
13283
+ expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
13284
+ expect(tokens[0][6].value).toBe("%b");
13285
+ expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
13286
+ expect(tokens[0][7].value).toBe("'");
13287
+ expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
13288
+ expect(tokens[0][8].value).toBe(" ");
13289
+ expect(tokens[0][8].scopes).toEqual(["source.python"]);
13290
+ expect(tokens[0][9].value).toBe("%");
13291
+ expect(tokens[0][9].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
13292
+ expect(tokens[0][10].value).toBe(" ");
13293
+ expect(tokens[0][10].scopes).toEqual(["source.python"]);
13294
+ expect(tokens[0][11].value).toBe("b");
13295
+ expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
13296
+ expect(tokens[0][12].value).toBe("'");
13297
+ expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
13298
+ expect(tokens[0][13].value).toBe("foo");
13299
+ expect(tokens[0][13].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
13300
+ expect(tokens[0][14].value).toBe("'");
13301
+ expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
13302
+ });
13303
+
13246
13304
it("test/strings/format2.py",
13247
13305
function() {
13248
13306
tokens = grammar.tokenizeLines("a = \"normal {{ normal }} normal {10!r} normal {fo.__add__!s}\".format(fo=1)")
0 commit comments