-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Add typescript-specific edge case tests to space-infix-ops (#1…
- Loading branch information
1 parent
d45b184
commit 577cbf1
Showing
2 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
155 changes: 155 additions & 0 deletions
155
tests/fixtures/parsers/typescript-parsers/type-alias.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
"use strict"; | ||
|
||
exports.parse = () => ({ | ||
type: "Program", | ||
range: [0, 16], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 16 } | ||
}, | ||
body: [ | ||
{ | ||
type: "VariableDeclaration", | ||
range: [0, 16], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 16 } | ||
}, | ||
kind: "type", | ||
declarations: [ | ||
{ | ||
type: "VariableDeclarator", | ||
id: { | ||
type: "Identifier", | ||
range: [ | ||
5, | ||
8 | ||
], | ||
loc: { | ||
start: { line: 1, column: 5 }, | ||
end: { line: 1, column: 8 } | ||
}, | ||
name: "Foo" | ||
}, | ||
init: { | ||
type: "TSTypeReference", | ||
range: [14, 15], | ||
loc: { | ||
start: { line: 1, column: 14 }, | ||
end: { line: 1, column: 15 } | ||
}, | ||
typeName: { | ||
type: "Identifier", | ||
range: [14, 15], | ||
loc: { | ||
start: { line: 1, column: 14 }, | ||
end: { line: 1, column: 15 } | ||
}, | ||
name: "T" | ||
} | ||
}, | ||
range: [5, 16], | ||
loc: { | ||
start: { line: 1, column: 5 }, | ||
end: { line: 1, column: 16 } | ||
}, | ||
typeParameters: { | ||
type: "TSTypeParameterDeclaration", | ||
range: [8, 11], | ||
loc: { | ||
start: { line: 1, column: 8 }, | ||
end: { line: 1, column: 11 } | ||
}, | ||
params: [ | ||
{ | ||
type: "TSTypeParameter", | ||
range: [9, 10], | ||
loc: { | ||
start: { line: 1, column: 9 }, | ||
end: { line: 1, column: 10 } | ||
}, | ||
name: "T" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
], | ||
sourceType: "script", | ||
tokens: [ | ||
{ | ||
type: "Identifier", | ||
value: "type", | ||
range: [0, 4], | ||
loc: { | ||
start: { line: 1, column: 0 }, | ||
end: { line: 1, column: 4 } | ||
} | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "Foo", | ||
range: [5, 8], | ||
loc: { | ||
start: { line: 1, column: 5 }, | ||
end: { line: 1, column: 8 } | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: "<", | ||
range: [8, 9], | ||
loc: { | ||
start: { line: 1, column: 8 }, | ||
end: { line: 1, column: 9 } | ||
} | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "T", | ||
range: [9, 10], | ||
loc: { | ||
start: { line: 1, column: 9 }, | ||
end: { line: 1, column: 10 } | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ">", | ||
range: [10, 11], | ||
loc: { | ||
start: { line: 1, column: 10 }, | ||
end: { line: 1, column: 11 } | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: "=", | ||
range: [12, 13], | ||
loc: { | ||
start: { line: 1, column: 12 }, | ||
end: { line: 1, column: 13 } | ||
} | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "T", | ||
range: [14, 15], | ||
loc: { | ||
start: { line: 1, column: 14 }, | ||
end: { line: 1, column: 15 } | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ";", | ||
range: [15, 16], | ||
loc: { | ||
start: { line: 1, column: 15 }, | ||
end: { line: 1, column: 16 } | ||
} | ||
} | ||
], | ||
comments: [] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters