Skip to content

Commit

Permalink
Merge pull request #3 from takenet/fix/json-parser-error-behavior
Browse files Browse the repository at this point in the history
Apply sebastienros#1038 pull request on JsonParse file.
  • Loading branch information
fadoaglauss committed Oct 18, 2022
2 parents 0e21a37 + d174786 commit 0fd6498
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Jint.Tests/Runtime/EngineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2783,7 +2783,7 @@ public void ShouldReportErrorForInvalidJson()
{
var engine = new Engine();
var ex = Assert.Throws<JavaScriptException>(() => engine.Execute("JSON.parse('[01]')"));
Assert.Equal("Unexpected token '1'", ex.Message);
Assert.Equal("Unexpected token '1' in JSON at position 2", ex.Message);

var voidCompletion = engine.Execute("try { JSON.parse('01') } catch (e) {}").GetCompletionValue();
Assert.Equal(JsValue.Undefined, voidCompletion);
Expand Down

0 comments on commit 0fd6498

Please sign in to comment.