diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-05-31 15:15:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-31 15:15:36 -0400 |
| commit | 57f0ab410766374b155fa546c31812d593480048 (patch) | |
| tree | f04dd0420e07800e2c6eb7eebb62c3313480ac26 /tools/slang-test/parse-diagnostic-util.cpp | |
| parent | c3e36444c53f592e1105783df73f67c169cfe7b9 (diff) | |
Confirm reflection output is valid JSON (#2910)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Small fixes and improvements around reflection tool.
* Make PrettyWriter printing a class.
* Confirm reflection output is valid JSON.
* Fix issue with diagnostic tests.
Diffstat (limited to 'tools/slang-test/parse-diagnostic-util.cpp')
| -rw-r--r-- | tools/slang-test/parse-diagnostic-util.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/slang-test/parse-diagnostic-util.cpp b/tools/slang-test/parse-diagnostic-util.cpp index 49cc2555b..1141f81c4 100644 --- a/tools/slang-test/parse-diagnostic-util.cpp +++ b/tools/slang-test/parse-diagnostic-util.cpp @@ -341,6 +341,20 @@ static UnownedStringSlice _getEquals(const UnownedStringSlice& in) return in.tail(equalsIndex + 1).trim(); } +static bool _isAtEnd(const UnownedStringSlice& text, const UnownedStringSlice& line) +{ + if (line != "}") + { + return false; + } + // We need to get the *next* line. If it is "}" then this isn't the final closing + UnownedStringSlice remaining(text); + UnownedStringSlice nextLine; + StringUtil::extractLine(remaining, nextLine); + + return (nextLine != toSlice("}")); +} + /* static */SlangResult ParseDiagnosticUtil::parseOutputInfo(const UnownedStringSlice& inText, OutputInfo& out) { enum State @@ -405,9 +419,9 @@ static UnownedStringSlice _getEquals(const UnownedStringSlice& in) case State::InStdError: case State::InStdOut: { - if (line == "}") + if (_isAtEnd(text, line)) { - String& dst = state == State::InStdError ? out.stdError : out.stdOut; + String& dst = (state == State::InStdError) ? out.stdError : out.stdOut; if (lines.getCount() > 0) { dst = UnownedStringSlice(lines[0].begin(), lines.getLast().end()); |
