Skip to content

Commit 4ab32d8

Browse files
authored
Merge pull request #729 from ethereum/fix_for_nlohmann_json
Update test "compiling standard JSON (invalid JSON)" to be nlohmann::json compatible
2 parents 14cff58 + 840f3b1 commit 4ab32d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/compiler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function runTests (solc, versionText) {
7676
const error = output.errors[errorIndex];
7777
if (error.type === errorType) {
7878
if (message) {
79-
if (error.message.match(message) !== null) {
79+
if (error.message === message || error.message.match(message) !== null) {
8080
return true;
8181
}
8282
} else {
@@ -751,7 +751,11 @@ function runTests (solc, versionText) {
751751
t.test('compiling standard JSON (invalid JSON)', function (st) {
752752
const output = JSON.parse(solc.compile('{invalid'));
753753
// TODO: change wrapper to output matching error
754-
st.ok(expectError(output, 'JSONError', 'Line 1, Column 2\n Missing \'}\' or object member name') || expectError(output, 'JSONError', 'Invalid JSON supplied:'));
754+
st.ok(
755+
expectError(output, 'JSONError', 'Line 1, Column 2\n Missing \'}\' or object member name') ||
756+
expectError(output, 'JSONError', 'Invalid JSON supplied:') ||
757+
expectError(output, 'JSONError', 'parse error at line 1, column 2: syntax error while parsing object key - invalid literal; last read: \'{i\'; expected string literal')
758+
);
755759
st.end();
756760
});
757761

0 commit comments

Comments
 (0)