Skip to content

Commit

Permalink
Add test for casting a method invocation.
Browse files Browse the repository at this point in the history
Related to #125
  • Loading branch information
JoeRobich authored Sep 1, 2023
1 parent 5ba30a7 commit de4b8a7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/expressions.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,35 @@ var x = new // comment
]);
});

it("cast of invocation", async () => {
const input = Input.InMethod(`
(int)y.M();
(int) y.M();
`);
const tokens = await tokenize(input);

tokens.should.deep.equal([
Token.Punctuation.OpenParen,
Token.PrimitiveType.Int,
Token.Punctuation.CloseParen,
Token.Variables.Object("y"),
Token.Punctuation.Accessor,
Token.Identifiers.MethodName("M"),
Token.Punctuation.OpenParen,
Token.Punctuation.CloseParen,
Token.Punctuation.Semicolon,
Token.Punctuation.OpenParen,
Token.PrimitiveType.Int,
Token.Punctuation.CloseParen,
Token.Variables.Object("y"),
Token.Punctuation.Accessor,
Token.Identifiers.MethodName("M"),
Token.Punctuation.OpenParen,
Token.Punctuation.CloseParen,
Token.Punctuation.Semicolon,
]);
});

it("as cast of identifier", async () => {
const input = Input.InMethod(`var x = o as List<Lazy<string>>;`);
const tokens = await tokenize(input);
Expand Down

0 comments on commit de4b8a7

Please sign in to comment.