From 322fb6c507aec483de3bd06bba26f6d9304bf406 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Mon, 18 Mar 2024 14:53:49 +0100 Subject: [PATCH] Change integration test to return stable results --- .../all-platforms/standalone/CompilerMessage.expected | 4 ---- .../all-platforms/standalone/CompilerMessage.ql | 6 ------ .../all-platforms/standalone/Diag.expected | 4 ++++ .../ql/integration-tests/all-platforms/standalone/Diag.ql | 6 ++++++ .../all-platforms/standalone/ExtractortMessages.expected | 5 ----- .../all-platforms/standalone/ExtractortMessages.ql | 6 ------ 6 files changed, 10 insertions(+), 21 deletions(-) delete mode 100644 csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.expected delete mode 100644 csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.ql create mode 100644 csharp/ql/integration-tests/all-platforms/standalone/Diag.expected create mode 100644 csharp/ql/integration-tests/all-platforms/standalone/Diag.ql delete mode 100644 csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.expected delete mode 100644 csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.ql diff --git a/csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.expected b/csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.expected deleted file mode 100644 index cd10fe6d1f09..000000000000 --- a/csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.expected +++ /dev/null @@ -1,4 +0,0 @@ -| Program.cs:2:9:2:9 | CS0103: The name 'M' does not exist in the current context | Error CS0103 The name 'M' does not exist in the current context | -| Program.cs:2:15:2:15 | CS0103: The name 'M' does not exist in the current context | Error CS0103 The name 'M' does not exist in the current context | -| test-db/working/implicitUsings/GlobalUsings.g.cs:7:1:7:37 | CS8019: Unnecessary using directive. | Hidden CS8019 Unnecessary using directive. | -| test-db/working/implicitUsings/GlobalUsings.g.cs:8:1:8:38 | CS8019: Unnecessary using directive. | Hidden CS8019 Unnecessary using directive. | diff --git a/csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.ql b/csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.ql deleted file mode 100644 index 495226cf99a5..000000000000 --- a/csharp/ql/integration-tests/all-platforms/standalone/CompilerMessage.ql +++ /dev/null @@ -1,6 +0,0 @@ -import csharp -import semmle.code.csharp.commons.Diagnostics - -from Diagnostic diagnostic -select diagnostic, - diagnostic.getSeverityText() + " " + diagnostic.getTag() + " " + diagnostic.getFullMessage() diff --git a/csharp/ql/integration-tests/all-platforms/standalone/Diag.expected b/csharp/ql/integration-tests/all-platforms/standalone/Diag.expected new file mode 100644 index 000000000000..1fcc47687caf --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone/Diag.expected @@ -0,0 +1,4 @@ +extractorMessages +| 5 | +compilerDiagnostics +| 4 | diff --git a/csharp/ql/integration-tests/all-platforms/standalone/Diag.ql b/csharp/ql/integration-tests/all-platforms/standalone/Diag.ql new file mode 100644 index 000000000000..bbd142d3af3e --- /dev/null +++ b/csharp/ql/integration-tests/all-platforms/standalone/Diag.ql @@ -0,0 +1,6 @@ +import csharp +import semmle.code.csharp.commons.Diagnostics + +query predicate extractorMessages(int c) { c = count(ExtractorMessage msg) } + +query predicate compilerDiagnostics(int c) { c = count(Diagnostic diag) } diff --git a/csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.expected b/csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.expected deleted file mode 100644 index 02b76fec42a7..000000000000 --- a/csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.expected +++ /dev/null @@ -1,5 +0,0 @@ -| Program.cs:2:9:2:11 | Failed to determine type | 5 | M() | -| Program.cs:2:9:2:17 | Failed to determine type | 5 | M() + M() | -| Program.cs:2:9:2:23 | Failed to determine type | 5 | M() + M() + M() | -| Program.cs:2:21:2:23 | Failed to determine type | 5 | M() | -| Program.cs:2:21:2:23 | Unable to resolve target for call. (Compilation error?) | 5 | M() | diff --git a/csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.ql b/csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.ql deleted file mode 100644 index 10b9822fc2e6..000000000000 --- a/csharp/ql/integration-tests/all-platforms/standalone/ExtractortMessages.ql +++ /dev/null @@ -1,6 +0,0 @@ -import csharp -import semmle.code.csharp.commons.Diagnostics - -query predicate extractorMessages(ExtractorMessage msg, int severity, string elementText) { - msg.getSeverity() = severity and msg.getElementText() = elementText -}