diff options
| author | Yong He <yonghe@outlook.com> | 2023-11-28 09:15:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 09:15:31 -0800 |
| commit | 62426e94ef11fd6baa213757f87114ec174b406e (patch) | |
| tree | 620b539efe2f01bfc213953a4893d09635093653 /tools | |
| parent | a2083d64fec7732195e533b6a2ed7d05cc9beedc (diff) | |
Misc language server fixes. (#3357)
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-test/slang-test-main.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 2395aad16..5de9a8dc6 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -1974,27 +1974,36 @@ TestResult runLanguageServerTest(TestContext* context, TestInput& input) actualOutput = redactedSB.produceString().trim(); - if (!_areResultsEqual(input.testOptions->type, expectedOutput, actualOutput)) + String fileCheckPrefix; + const bool isFileCheckTest = input.testOptions->getFileCheckPrefix(fileCheckPrefix); + if (isFileCheckTest) { - if (expectedOutput.startsWith("CONTAINS")) + result = _fileCheckTest(*context, input.filePath, fileCheckPrefix, actualOutput); + } + else + { + if (!_areResultsEqual(input.testOptions->type, expectedOutput, actualOutput)) { - List<UnownedStringSlice> words; - List<UnownedStringSlice> expectedLines; - StringUtil::calcLines(expectedOutput.getUnownedSlice(), expectedLines); - if (expectedLines.getCount() >= 1) + if (expectedOutput.startsWith("CONTAINS")) { - StringUtil::split(expectedLines[0], ' ', words); - if (words.getCount() >= 2) + List<UnownedStringSlice> words; + List<UnownedStringSlice> expectedLines; + StringUtil::calcLines(expectedOutput.getUnownedSlice(), expectedLines); + if (expectedLines.getCount() >= 1) { - if (actualOutput.contains(words[1].trim())) + StringUtil::split(expectedLines[0], ' ', words); + if (words.getCount() >= 2) { - return result; + if (actualOutput.contains(words[1].trim())) + { + return result; + } } } } + context->getTestReporter()->dumpOutputDifference(expectedOutput, actualOutput); + result = TestResult::Fail; } - context->getTestReporter()->dumpOutputDifference(expectedOutput, actualOutput); - result = TestResult::Fail; } // If the test failed, then we write the actual output to a file |
