* Updated Esprima package from 1.0.0-beta-1186 to 1.0.0-beta-1202 * Added test for handling parser exception of javascript parser.
@@ -172,5 +172,16 @@ namespace Jint.Tests.Parser
{
Assert.Throws<JavaScriptException>(() => new Engine().Execute("~ (WE0=1)--- l('1');"));
}
+
+ [Theory]
+ [InlineData("....")]
+ [InlineData("while")]
+ [InlineData("var")]
+ [InlineData("-.-")]
+ public void ShouldThrowParserExceptionForInvalidCode(string code)
+ {
+ Assert.Throws<ParserException>(() => new JavaScriptParser(code).ParseProgram());
+ }
-}
+}
@@ -7,6 +7,6 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Esprima" Version="1.0.0-beta-1186" />
+ <PackageReference Include="Esprima" Version="1.0.0-beta-1202" />
</ItemGroup>
</Project>