Skip to content

Commit edc5948

Browse files
committed
Update test runner to forgive variant context strings in Error messages
1 parent b4127a8 commit edc5948

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/test/run.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,23 @@ function runOneSync(name, selname, p) {
3434
});
3535
} catch(e) {
3636
got = e.toString();
37-
if (want.trim() != got.trim()) throw e;
37+
if (want.trim() != got.trim()) {
38+
39+
// The error messages will have consistent prefix strings, but variant context strings
40+
if ( want.trim().indexOf("Error") === -1 && got.trim().indexOf( want.trim() ) !== 0 ) {
41+
throw e;
42+
}
43+
//console.log( "want: " + want.trim() );
44+
//console.log( "got: " + got.trim() );
45+
}
46+
}
47+
if (want.trim() != got.trim()) {
48+
//console.log( "want: " + want.trim() );
49+
//console.log( "got: " + got.trim() );
50+
if ( want.trim().indexOf("Error") === -1 && got.trim().indexOf( want.trim() ) !== 0 ) {
51+
throw "mismatch";
52+
}
3853
}
39-
if (want.trim() != got.trim()) throw "mismatch";
4054
}
4155

4256

0 commit comments

Comments
 (0)