Skip to content

Commit 1df0613

Browse files
committed
Update integration tests to include newly reported diagnostic
1 parent a010efb commit 1df0613

File tree

2 files changed

+50
-40
lines changed

2 files changed

+50
-40
lines changed

test/integrationTests/documentDiagnostics.integration.test.ts

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,34 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
3232
});
3333

3434
await waitForExpectedFileDiagnostics((diagnostics) => {
35-
expect(diagnostics).toHaveLength(4);
35+
expect(diagnostics).toHaveLength(5);
3636

3737
expect(getCode(diagnostics[0])).toBe('IDE0005');
3838
expect(diagnostics[0].message).toBe('Using directive is unnecessary.');
3939
expect(diagnostics[0].range).toEqual(new vscode.Range(0, 0, 0, 16));
4040
expect(diagnostics[0].severity).toBe(vscode.DiagnosticSeverity.Hint);
4141

42-
expect(getCode(diagnostics[1])).toBe('CA1822');
43-
expect(diagnostics[1].message).toBe(
44-
"Member 'FooBarBar' does not access instance data and can be marked as static"
45-
);
46-
expect(diagnostics[1].range).toEqual(new vscode.Range(6, 20, 6, 29));
42+
expect(getCode(diagnostics[1])).toBe('IDE0130');
43+
expect(diagnostics[1].message).toBe('Namespace "Foo" does not match folder structure, expected "app"');
44+
expect(diagnostics[1].range).toEqual(new vscode.Range(2, 10, 2, 13));
4745
expect(diagnostics[1].severity).toBe(vscode.DiagnosticSeverity.Hint);
4846

49-
expect(getCode(diagnostics[2])).toBe('CS0219');
50-
expect(diagnostics[2].message).toBe("The variable 'notUsed' is assigned but its value is never used");
51-
expect(diagnostics[2].range).toEqual(new vscode.Range(8, 16, 8, 23));
52-
expect(diagnostics[2].severity).toBe(vscode.DiagnosticSeverity.Warning);
47+
expect(getCode(diagnostics[2])).toBe('CA1822');
48+
expect(diagnostics[2].message).toBe(
49+
"Member 'FooBarBar' does not access instance data and can be marked as static"
50+
);
51+
expect(diagnostics[2].range).toEqual(new vscode.Range(6, 20, 6, 29));
52+
expect(diagnostics[2].severity).toBe(vscode.DiagnosticSeverity.Hint);
5353

54-
expect(getCode(diagnostics[3])).toBe('IDE0059');
55-
expect(diagnostics[3].message).toBe("Unnecessary assignment of a value to 'notUsed'");
54+
expect(getCode(diagnostics[3])).toBe('CS0219');
55+
expect(diagnostics[3].message).toBe("The variable 'notUsed' is assigned but its value is never used");
5656
expect(diagnostics[3].range).toEqual(new vscode.Range(8, 16, 8, 23));
57-
expect(diagnostics[3].severity).toBe(vscode.DiagnosticSeverity.Hint);
57+
expect(diagnostics[3].severity).toBe(vscode.DiagnosticSeverity.Warning);
58+
59+
expect(getCode(diagnostics[4])).toBe('IDE0059');
60+
expect(diagnostics[4].message).toBe("Unnecessary assignment of a value to 'notUsed'");
61+
expect(diagnostics[4].range).toEqual(new vscode.Range(8, 16, 8, 23));
62+
expect(diagnostics[4].severity).toBe(vscode.DiagnosticSeverity.Hint);
5863
}, file);
5964
});
6065

@@ -65,12 +70,12 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
6570
});
6671

6772
await waitForExpectedFileDiagnostics((diagnostics) => {
68-
expect(diagnostics).toHaveLength(4);
73+
expect(diagnostics).toHaveLength(5);
6974

70-
expect(getCode(diagnostics[2])).toBe('CS0219');
71-
expect(diagnostics[2].message).toBe("The variable 'notUsed' is assigned but its value is never used");
72-
expect(diagnostics[2].range).toEqual(new vscode.Range(8, 16, 8, 23));
73-
expect(diagnostics[2].severity).toBe(vscode.DiagnosticSeverity.Warning);
75+
expect(getCode(diagnostics[3])).toBe('CS0219');
76+
expect(diagnostics[3].message).toBe("The variable 'notUsed' is assigned but its value is never used");
77+
expect(diagnostics[3].range).toEqual(new vscode.Range(8, 16, 8, 23));
78+
expect(diagnostics[3].severity).toBe(vscode.DiagnosticSeverity.Warning);
7479
}, file);
7580
});
7681

@@ -83,7 +88,7 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
8388
await integrationHelpers.restartLanguageServer();
8489

8590
await waitForExpectedFileDiagnostics((diagnostics) => {
86-
expect(diagnostics).toHaveLength(3);
91+
expect(diagnostics).toHaveLength(4);
8792

8893
expect(diagnostics.some((d) => getCode(d).startsWith('CS'))).toBe(false);
8994
}, file);
@@ -96,24 +101,29 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
96101
});
97102

98103
await waitForExpectedFileDiagnostics((diagnostics) => {
99-
expect(diagnostics).toHaveLength(4);
104+
expect(diagnostics).toHaveLength(5);
100105

101106
expect(getCode(diagnostics[0])).toBe('IDE0005');
102107
expect(diagnostics[0].message).toBe('Using directive is unnecessary.');
103108
expect(diagnostics[0].range).toEqual(new vscode.Range(0, 0, 0, 16));
104109
expect(diagnostics[0].severity).toBe(vscode.DiagnosticSeverity.Hint);
105110

106-
expect(getCode(diagnostics[1])).toBe('CA1822');
107-
expect(diagnostics[1].message).toBe(
111+
expect(getCode(diagnostics[1])).toBe('IDE0130');
112+
expect(diagnostics[1].message).toBe('Namespace "Foo" does not match folder structure, expected "app"');
113+
expect(diagnostics[1].range).toEqual(new vscode.Range(2, 10, 2, 13));
114+
expect(diagnostics[1].severity).toBe(vscode.DiagnosticSeverity.Hint);
115+
116+
expect(getCode(diagnostics[2])).toBe('CA1822');
117+
expect(diagnostics[2].message).toBe(
108118
"Member 'FooBarBar' does not access instance data and can be marked as static"
109119
);
110-
expect(diagnostics[1].range).toEqual(new vscode.Range(6, 20, 6, 29));
111-
expect(diagnostics[1].severity).toBe(vscode.DiagnosticSeverity.Hint);
120+
expect(diagnostics[2].range).toEqual(new vscode.Range(6, 20, 6, 29));
121+
expect(diagnostics[2].severity).toBe(vscode.DiagnosticSeverity.Hint);
112122

113-
expect(getCode(diagnostics[3])).toBe('IDE0059');
114-
expect(diagnostics[3].message).toBe("Unnecessary assignment of a value to 'notUsed'");
115-
expect(diagnostics[3].range).toEqual(new vscode.Range(8, 16, 8, 23));
116-
expect(diagnostics[3].severity).toBe(vscode.DiagnosticSeverity.Hint);
123+
expect(getCode(diagnostics[4])).toBe('IDE0059');
124+
expect(diagnostics[4].message).toBe("Unnecessary assignment of a value to 'notUsed'");
125+
expect(diagnostics[4].range).toEqual(new vscode.Range(8, 16, 8, 23));
126+
expect(diagnostics[4].severity).toBe(vscode.DiagnosticSeverity.Hint);
117127
}, file);
118128
});
119129

test/integrationTests/workspaceDiagnostics.integration.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
3535
.filter(([uri, _]) => uri.fsPath.endsWith('completion.cs'))
3636
.flatMap(([_, diagnostics]) => diagnostics);
3737

38-
expect(diagnosticsInDiagnosticsCs).toHaveLength(4);
39-
expect(diagnosticsInCompletionCs).toHaveLength(4);
38+
expect(diagnosticsInDiagnosticsCs).toHaveLength(5);
39+
expect(diagnosticsInCompletionCs).toHaveLength(5);
4040

4141
// Compiler diagnostic in diagnostics.cs
42-
expect(getCode(diagnosticsInDiagnosticsCs[2])).toBe('CS0219');
43-
expect(diagnosticsInDiagnosticsCs[2].message).toBe(
42+
expect(getCode(diagnosticsInDiagnosticsCs[3])).toBe('CS0219');
43+
expect(diagnosticsInDiagnosticsCs[3].message).toBe(
4444
"The variable 'notUsed' is assigned but its value is never used"
4545
);
46-
expect(diagnosticsInDiagnosticsCs[2].range).toEqual(new vscode.Range(8, 16, 8, 23));
47-
expect(diagnosticsInDiagnosticsCs[2].severity).toBe(vscode.DiagnosticSeverity.Warning);
46+
expect(diagnosticsInDiagnosticsCs[3].range).toEqual(new vscode.Range(8, 16, 8, 23));
47+
expect(diagnosticsInDiagnosticsCs[3].severity).toBe(vscode.DiagnosticSeverity.Warning);
4848

4949
// Analyzer diagnostic in diagnostics.cs
50-
expect(getCode(diagnosticsInDiagnosticsCs[1])).toBe('CA1822');
51-
expect(diagnosticsInDiagnosticsCs[1].message).toBe(
50+
expect(getCode(diagnosticsInDiagnosticsCs[2])).toBe('CA1822');
51+
expect(diagnosticsInDiagnosticsCs[2].message).toBe(
5252
"Member 'FooBarBar' does not access instance data and can be marked as static"
5353
);
54-
expect(diagnosticsInDiagnosticsCs[1].range).toEqual(new vscode.Range(6, 20, 6, 29));
55-
expect(diagnosticsInDiagnosticsCs[1].severity).toBe(vscode.DiagnosticSeverity.Hint);
54+
expect(diagnosticsInDiagnosticsCs[2].range).toEqual(new vscode.Range(6, 20, 6, 29));
55+
expect(diagnosticsInDiagnosticsCs[2].severity).toBe(vscode.DiagnosticSeverity.Hint);
5656

5757
// Analyzer diagnostic in completion.cs
5858
expect(getCode(diagnosticsInCompletionCs[0])).toBe('IDE0005');
@@ -75,7 +75,7 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
7575
.filter(([uri, _]) => uri.fsPath.endsWith('diagnostics.cs'))
7676
.flatMap(([_, diagnostics]) => diagnostics);
7777

78-
expect(diagnosticsInDiagnosticsCs).toHaveLength(3);
78+
expect(diagnosticsInDiagnosticsCs).toHaveLength(4);
7979
expect(diagnosticsInDiagnosticsCs.some((d) => getCode(d).startsWith('CS'))).toBe(false);
8080
});
8181
});
@@ -93,7 +93,7 @@ describe(`[${testAssetWorkspace.description}] Test diagnostics`, function () {
9393
.filter(([uri, _]) => uri.fsPath.endsWith('diagnostics.cs'))
9494
.flatMap(([_, diagnostics]) => diagnostics);
9595

96-
expect(diagnosticsInDiagnosticsCs).toHaveLength(3);
96+
expect(diagnosticsInDiagnosticsCs).toHaveLength(4);
9797
expect(diagnosticsInDiagnosticsCs.some((d) => getCode(d).startsWith('CS'))).toBe(false);
9898
});
9999
});

0 commit comments

Comments
 (0)