Skip to content

Commit 7be2d28

Browse files
Classification tests.
1 parent ebb0beb commit 7be2d28

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

tests/cases/fourslash/fourslash.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ module FourSlashInterface {
386386
public syntacticClassificationsAre(...classifications: { classificationType: string; text: string }[]) {
387387
FourSlash.currentTestState.verifySyntacticClassifications(classifications);
388388
}
389+
390+
public semanticClassificationsAre(...classifications: { classificationType: string; text: string }[]) {
391+
FourSlash.currentTestState.verifySemanticClassifications(classifications);
392+
}
389393
}
390394

391395
export class edit {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// module M {
4+
//// export interface I {
5+
//// }
6+
//// }
7+
//// interface X extends M.I { }
8+
9+
debugger;
10+
var c = classification;
11+
verify.semanticClassificationsAre(
12+
c.moduleName("M"), c.interfaceName("I"), c.interfaceName("X"), c.moduleName("M"), c.interfaceName("I"));
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// // comment
4+
//// module M {
5+
//// var v = 0 + 1;
6+
//// var s = "string";
7+
////
8+
//// class C<T> {
9+
//// }
10+
////
11+
//// enum E {
12+
//// }
13+
////
14+
//// interface I {
15+
//// }
16+
////
17+
//// module M1.M2 {
18+
//// }
19+
//// }
20+
21+
debugger;
22+
var c = classification;
23+
verify.syntacticClassificationsAre(
24+
c.comment("// comment"),
25+
c.keyword("module"), c.moduleName("M"), c.punctuation("{"),
26+
c.keyword("var"), c.text("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"),
27+
c.keyword("var"), c.text("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"),
28+
c.keyword("class"), c.className("C"), c.punctuation("<"), c.typeParameterName("T"), c.punctuation(">"), c.punctuation("{"),
29+
c.punctuation("}"),
30+
c.keyword("enum"), c.enumName("E"), c.punctuation("{"),
31+
c.punctuation("}"),
32+
c.keyword("interface"), c.interfaceName("I"), c.punctuation("{"),
33+
c.punctuation("}"),
34+
c.keyword("module"), c.moduleName("M1"), c.punctuation("."), c.moduleName("M2"), c.punctuation("{"),
35+
c.punctuation("}"),
36+
c.punctuation("}"));

0 commit comments

Comments
 (0)