Skip to content

Commit

Permalink
Merge pull request #289 from dotnet/dev/jorobich/add-cast-test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Sep 2, 2023
2 parents b75bcbf + 8c1d843 commit 1fc58ea
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.Variable.Object("y"),
Token.Punctuation.Accessor,
Token.Identifier.MethodName("M"),
Token.Punctuation.OpenParen,
Token.Punctuation.CloseParen,
Token.Punctuation.Semicolon,
Token.Punctuation.OpenParen,
Token.PrimitiveType.Int,
Token.Punctuation.CloseParen,
Token.Variable.Object("y"),
Token.Punctuation.Accessor,
Token.Identifier.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 1fc58ea

Please sign in to comment.