@@ -11,7 +11,6 @@ describe("Grammar", () => {
1111
1212 describe ( "Type names" , ( ) => {
1313 it ( "built-in type - object" , ( ) => {
14-
1514 const input = Input . InClass ( `object x;` ) ;
1615 const tokens = tokenize ( input ) ;
1716
@@ -22,7 +21,6 @@ describe("Grammar", () => {
2221 } ) ;
2322
2423 it ( "qualified name - System.Object" , ( ) => {
25-
2624 const input = Input . InClass ( `System.Object x;` ) ;
2725 const tokens = tokenize ( input ) ;
2826
@@ -35,7 +33,6 @@ describe("Grammar", () => {
3533 } ) ;
3634
3735 it ( "globally-qualified name - global::System.Object" , ( ) => {
38-
3936 const input = Input . InClass ( `global::System.Object x;` ) ;
4037 const tokens = tokenize ( input ) ;
4138
@@ -50,7 +47,6 @@ describe("Grammar", () => {
5047 } ) ;
5148
5249 it ( "tuple type - (int, int)" , ( ) => {
53-
5450 const input = Input . InClass ( `(int, int) x;` ) ;
5551 const tokens = tokenize ( input ) ;
5652
@@ -64,8 +60,23 @@ describe("Grammar", () => {
6460 Token . Punctuation . Semicolon ] ) ;
6561 } ) ;
6662
67- it ( "generic type - List<int>" , ( ) => {
63+ it ( "tuple type with element names - (int i, int j)" , ( ) => {
64+ const input = Input . InClass ( `(int i, int j) x;` ) ;
65+ const tokens = tokenize ( input ) ;
6866
67+ tokens . should . deep . equal ( [
68+ Token . Punctuation . OpenParen ,
69+ Token . PrimitiveType . Int ,
70+ Token . Identifiers . TupleElementName ( "i" ) ,
71+ Token . Punctuation . Comma ,
72+ Token . PrimitiveType . Int ,
73+ Token . Identifiers . TupleElementName ( "j" ) ,
74+ Token . Punctuation . CloseParen ,
75+ Token . Identifiers . FieldName ( "x" ) ,
76+ Token . Punctuation . Semicolon ] ) ;
77+ } ) ;
78+
79+ it ( "generic type - List<int>" , ( ) => {
6980 const input = Input . InClass ( `List<int> x;` ) ;
7081 const tokens = tokenize ( input ) ;
7182
@@ -79,7 +90,6 @@ describe("Grammar", () => {
7990 } ) ;
8091
8192 it ( "generic type with tuple - List<(int, int)>" , ( ) => {
82-
8393 const input = Input . InClass ( `List<(int, int)> x;` ) ;
8494 const tokens = tokenize ( input ) ;
8595
@@ -96,8 +106,26 @@ describe("Grammar", () => {
96106 Token . Punctuation . Semicolon ] ) ;
97107 } ) ;
98108
99- it ( "generic type with multiple parameters - Dictionary<int, int>" , ( ) => {
109+ it ( "generic type with tuple with element names - List<(int i, int j)>" , ( ) => {
110+ const input = Input . InClass ( `List<(int i, int j)> x;` ) ;
111+ const tokens = tokenize ( input ) ;
112+
113+ tokens . should . deep . equal ( [
114+ Token . Type ( "List" ) ,
115+ Token . Punctuation . TypeParameters . Begin ,
116+ Token . Punctuation . OpenParen ,
117+ Token . PrimitiveType . Int ,
118+ Token . Identifiers . TupleElementName ( "i" ) ,
119+ Token . Punctuation . Comma ,
120+ Token . PrimitiveType . Int ,
121+ Token . Identifiers . TupleElementName ( "j" ) ,
122+ Token . Punctuation . CloseParen ,
123+ Token . Punctuation . TypeParameters . End ,
124+ Token . Identifiers . FieldName ( "x" ) ,
125+ Token . Punctuation . Semicolon ] ) ;
126+ } ) ;
100127
128+ it ( "generic type with multiple parameters - Dictionary<int, int>" , ( ) => {
101129 const input = Input . InClass ( `Dictionary<int, int> x;` ) ;
102130 const tokens = tokenize ( input ) ;
103131
@@ -113,7 +141,6 @@ describe("Grammar", () => {
113141 } ) ;
114142
115143 it ( "qualified generic type - System.Collections.Generic.List<int>" , ( ) => {
116-
117144 const input = Input . InClass ( `System.Collections.Generic.List<int> x;` ) ;
118145 const tokens = tokenize ( input ) ;
119146
@@ -133,7 +160,6 @@ describe("Grammar", () => {
133160 } ) ;
134161
135162 it ( "generic type with nested type - List<int>.Enumerator" , ( ) => {
136-
137163 const input = Input . InClass ( `List<int>.Enumerator x;` ) ;
138164 const tokens = tokenize ( input ) ;
139165
@@ -149,7 +175,6 @@ describe("Grammar", () => {
149175 } ) ;
150176
151177 it ( "nullable type - int?" , ( ) => {
152-
153178 const input = Input . InClass ( `int? x;` ) ;
154179 const tokens = tokenize ( input ) ;
155180
0 commit comments