Skip to content

Commit

Permalink
Gets the tests green
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Jun 29, 2020
1 parent 58e830c commit 7d13c29
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 51 deletions.
6 changes: 3 additions & 3 deletions src/harness/fourslashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2497,15 +2497,15 @@ namespace FourSlash {
jsonMismatchString());
}

ts.zipWith(expected, actual, (expectedClassification, actualClassification) => {
ts.zipWith(expected, actual, (expectedClassification, actualClassification, index) => {
const expectedType = expectedClassification.classificationType;
const actualType = typeof actualClassification.classificationType === "number" ? this.classificationToIdentifier(actualClassification.classificationType) : actualClassification.classificationType;

if (expectedType !== actualType) {
this.raiseError("verifyClassifications failed - expected classifications type to be " +
this.raiseError(`verifyClassifications failed - expected classifications at index ${index} type to be ` +
expectedType + ", but was " +
actualType +
jsonMismatchString());
displayExpectedAndActualString(JSON.stringify(expectedType, undefined, 4), JSON.stringify(actualType, undefined, 5)));
}

const expectedSpan = expectedClassification.textSpan;
Expand Down
14 changes: 7 additions & 7 deletions tests/cases/fourslash/semanticClassificationClassExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ verify.semanticClassificationsAre("original",
c.className("B", test.marker("3").position)
);

const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("class.declaration", "x"),
c2.semanticToken("class", "C"),
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("class.declaration", "D"),
c2.semanticToken("class", "B"),
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("class.declaration", "x"),
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("class.declaration", "D"),
c2.semanticToken("class.declaration", "B"),
);
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ verify.semanticClassificationsAre("original",
c.moduleName("M", test.marker("0").position),
c.interfaceName("I", test.marker("1").position));


const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable", "M"),
c2.semanticToken("namespace.declaration", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("property.declaration", "I"),
);

Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ verify.semanticClassificationsAre("original",
c.moduleName("M", test.marker("3").position),
c.interfaceName("I", test.marker("4").position));

const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("property.declaration", "foo"),
c2.semanticToken("property.declaration", "bar"),
c2.semanticToken("variable.declaration", "v"),
c2.semanticToken("variable", "M"),
c2.semanticToken("interface", "I"),
c2.semanticToken("variable.declaration", "x"),
c2.semanticToken("variable", "M"),
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("namespace.declaration", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("property.declaration", "foo"),
c2.semanticToken("property.declaration", "bar"),
c2.semanticToken("variable.declaration", "v"),
c2.semanticToken("variable", "M"),
c2.semanticToken("interface", "I"),
c2.semanticToken("variable.declaration", "x"),
c2.semanticToken("variable", "M"),
);

28 changes: 14 additions & 14 deletions tests/cases/fourslash/semanticClassificationWithUnionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ verify.semanticClassificationsAre("original",
c.className("C", test.marker("7").position),
c.className("C", test.marker("8").position));

const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("variable", "M"),
c2.semanticToken("interface", "I"),
c2.semanticToken("interface", "I"),
c2.semanticToken("class", "C"),
c2.semanticToken("class.declaration", "I"),
c2.semanticToken("variable", "M"),
c2.semanticToken("class", "C"),
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("namespace.declaration", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("variable", "M"),
c2.semanticToken("interface", "I"),
c2.semanticToken("interface", "I"),
c2.semanticToken("class", "C"),
c2.semanticToken("class.declaration", "I"),
c2.semanticToken("variable", "M"),
c2.semanticToken("class", "C"),
);
10 changes: 5 additions & 5 deletions tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ verify.syntacticClassificationsAre(
c.punctuation("{"),
c.punctuation("}")
);

const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable.declaration", "of"),
c2.semanticToken("variable", "of"),
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable.declaration.local", "of"),
c2.semanticToken("variable.local", "of"),
);
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ verify.syntacticClassificationsAre(

const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable.declaration", "of"),
c2.semanticToken("variable", "of"),
c2.semanticToken("variable.declaration.local", "of"),
c2.semanticToken("variable.local", "of"),
);
10 changes: 5 additions & 5 deletions tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ verify.syntacticClassificationsAre(
c.punctuation("}")
);

const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable.declaration", "of"),
c2.semanticToken("variable", "of"),
c2.semanticToken("variable", "of"),
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable.declaration.local", "of"),
c2.semanticToken("variable.local", "of"),
c2.semanticToken("variable.local", "of"),
);

0 comments on commit 7d13c29

Please sign in to comment.