Skip to content

Commit

Permalink
Code review comments + removed dependency on Task and async
Browse files Browse the repository at this point in the history
  • Loading branch information
twop committed May 12, 2021
1 parent d0eea23 commit 0060bd6
Show file tree
Hide file tree
Showing 17 changed files with 424 additions and 549 deletions.
2 changes: 1 addition & 1 deletion Jint.Tests.Test262/BuiltIns/PromiseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PromiseTests : Test262Test
[MemberData(nameof(SourceFiles), "built-ins\\Promise", true, Skip = "Skipped")]
protected void Promise(SourceFile sourceFile)
{
RunTestInternal(sourceFile);
RunTestInternal(sourceFile, withEventLoop: true);
}
}
}
4 changes: 2 additions & 2 deletions Jint.Tests.Test262/SingleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public void TestSingle()

if (code.IndexOf("onlyStrict", StringComparison.Ordinal) < 0)
{
RunTestCode(code, strict: false);
RunTestCode(code, strict: false, withEventLoop:false);
}

if (code.IndexOf("noStrict", StringComparison.Ordinal) < 0)
{
RunTestCode(code, strict: true);
RunTestCode(code, strict: true, withEventLoop:false);
}
}
}
Expand Down
17 changes: 12 additions & 5 deletions Jint.Tests.Test262/Test262Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static Test262Test()
}
}

protected void RunTestCode(string code, bool strict)
protected void RunTestCode(string code, bool strict, bool withEventLoop)
{
var engine = new Engine(cfg => cfg
.LocalTimeZone(_pacificTimeZone)
Expand Down Expand Up @@ -139,7 +139,14 @@ protected void RunTestCode(string code, bool strict)
bool negative = code.IndexOf("negative:", StringComparison.Ordinal) > -1;
try
{
engine.Execute(code);
if (withEventLoop)
{
engine.ExecuteWithEventLoop(code);
}
else
{
engine.Execute(code);
}
}
catch (JavaScriptException j)
{
Expand All @@ -156,7 +163,7 @@ protected void RunTestCode(string code, bool strict)
}
}

protected void RunTestInternal(SourceFile sourceFile)
protected void RunTestInternal(SourceFile sourceFile, bool withEventLoop = false)
{
if (sourceFile.Skip)
{
Expand All @@ -165,13 +172,13 @@ protected void RunTestInternal(SourceFile sourceFile)

if (sourceFile.Code.IndexOf("onlyStrict", StringComparison.Ordinal) < 0)
{
RunTestCode(sourceFile.Code, strict: false);
RunTestCode(sourceFile.Code, strict: false, withEventLoop);
}

if (!_strictSkips.Contains(sourceFile.Source)
&& sourceFile.Code.IndexOf("noStrict", StringComparison.Ordinal) < 0)
{
RunTestCode(sourceFile.Code, strict: true);
RunTestCode(sourceFile.Code, strict: true, withEventLoop);
}
}

Expand Down

0 comments on commit 0060bd6

Please sign in to comment.