Skip to content

Commit

Permalink
Upgrade to Test262Harness 1.0.0 (#1779)
Browse files Browse the repository at this point in the history
* use latest commit hash
* minor other package upgrades
  • Loading branch information
lahma authored Feb 17, 2024
1 parent 9368af4 commit 9fd46c3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageVersion Include="Esprima" Version="3.0.4" />
<PackageVersion Include="Flurl.Http.Signed" Version="3.2.4" />
<PackageVersion Include="Jurassic" Version="3.2.7" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.135" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.141" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
Expand All @@ -22,9 +22,9 @@
<PackageVersion Include="SharpZipLib" Version="1.4.0" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.45.0" />
<PackageVersion Include="System.Text.Json" Version="6.0.8" />
<PackageVersion Include="Test262Harness" Version="0.0.23" />
<PackageVersion Include="xunit" Version="2.6.5" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" PrivateAssets="all" />
<PackageVersion Include="Test262Harness" Version="1.0.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" PrivateAssets="all" />
<PackageVersion Include="YantraJS.Core" Version="1.2.206" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Jint.Tests.Test262/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"test262harness.console": {
"version": "0.0.23",
"version": "1.0.0",
"commands": [
"test262"
]
Expand Down
2 changes: 1 addition & 1 deletion Jint.Tests.Test262/Test262Harness.settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SuiteGitSha": "a1ba783ca340e4bf3d80b5f5e11fa54f2ee5f1ef",
"SuiteGitSha": "45e740928f9ac3c2144307fee20bb58570fb9588",
//"SuiteDirectory": "//mnt/c/work/test262",
"TargetPath": "./Generated",
"Namespace": "Jint.Tests.Test262",
Expand Down
80 changes: 40 additions & 40 deletions Jint.Tests/Runtime/PromiseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,31 @@ public void Execute_ConcurrentNormalExecuteCall_WorksFine()
Assert.Equal(true, engine.Evaluate(" 1 + 1 === 2"));
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseCtorWithNoResolver_Throws()
{
var engine = new Engine();

Assert.Throws<JavaScriptException>(() => { engine.Execute("new Promise();"); });
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseCtorWithInvalidResolver_Throws()
{
var engine = new Engine();

Assert.Throws<JavaScriptException>(() => { engine.Execute("new Promise({});"); });
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseCtorWithValidResolver_DoesNotThrow()
{
var engine = new Engine();

engine.Execute("new Promise((resolve, reject)=>{});");
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseCtor_ReturnsPromiseJsValue()
{
var engine = new Engine();
Expand All @@ -130,22 +130,22 @@ public void PromiseCtor_ReturnsPromiseJsValue()
Assert.IsType<JsPromise>(promise);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseResolveViaResolver_ReturnsCorrectValue()
{
var engine = new Engine();
var res = engine.Evaluate("new Promise((resolve, reject)=>{resolve(66);});").UnwrapIfPromise();
Assert.Equal(66, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseResolveViaStatic_ReturnsCorrectValue()
{
var engine = new Engine();
Assert.Equal(66, engine.Evaluate("Promise.resolve(66);").UnwrapIfPromise());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRejectViaResolver_ThrowsPromiseRejectedException()
{
var engine = new Engine();
Expand All @@ -158,7 +158,7 @@ public void PromiseRejectViaResolver_ThrowsPromiseRejectedException()
Assert.Equal("Could not connect", ex.RejectedValue.AsString());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRejectViaStatic_ThrowsPromiseRejectedException()
{
var engine = new Engine();
Expand All @@ -171,7 +171,7 @@ public void PromiseRejectViaStatic_ThrowsPromiseRejectedException()
Assert.Equal("Could not connect", ex.RejectedValue.AsString());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedThen_HandlerCalledWithCorrectValue()
{
var engine = new Engine();
Expand All @@ -182,7 +182,7 @@ public void PromiseChainedThen_HandlerCalledWithCorrectValue()
Assert.Equal(44, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseThen_ReturnsNewPromiseInstance()
{
var engine = new Engine();
Expand All @@ -192,7 +192,7 @@ public void PromiseThen_ReturnsNewPromiseInstance()
Assert.Equal(false, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseThen_CalledCorrectlyOnResolve()
{
var engine = new Engine();
Expand All @@ -202,15 +202,15 @@ public void PromiseThen_CalledCorrectlyOnResolve()
Assert.Equal(66, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseResolveChainedWithHandler_ResolvedAsUndefined()
{
var engine = new Engine();

Assert.Equal(JsValue.Undefined, engine.Evaluate("Promise.resolve(33).then(() => {});").UnwrapIfPromise());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedThenWithUndefinedCallback_PassesThroughValueCorrectly()
{
var engine = new Engine();
Expand All @@ -220,7 +220,7 @@ public void PromiseChainedThenWithUndefinedCallback_PassesThroughValueCorrectly(
Assert.Equal(66, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedThenWithCallbackReturningUndefined_PassesThroughUndefinedCorrectly()
{
var engine = new Engine();
Expand All @@ -230,7 +230,7 @@ public void PromiseChainedThenWithCallbackReturningUndefined_PassesThroughUndefi
Assert.Equal(JsValue.Undefined, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedThenThrowsError_ChainedCallsCatchWithThrownError()
{
var engine = new Engine();
Expand All @@ -240,7 +240,7 @@ public void PromiseChainedThenThrowsError_ChainedCallsCatchWithThrownError()
Assert.Equal("Thrown Error", res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedThenReturnsResolvedPromise_ChainedCallsThenWithPromiseValue()
{
var engine = new Engine();
Expand All @@ -250,7 +250,7 @@ public void PromiseChainedThenReturnsResolvedPromise_ChainedCallsThenWithPromise
Assert.Equal(55, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedThenReturnsRejectedPromise_ChainedCallsCatchWithPromiseValue()
{
var engine = new Engine();
Expand All @@ -260,7 +260,7 @@ public void PromiseChainedThenReturnsRejectedPromise_ChainedCallsCatchWithPromis
Assert.Equal("Error Message", res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseCatch_CalledCorrectlyOnReject()
{
var engine = new Engine();
Expand All @@ -270,7 +270,7 @@ public void PromiseCatch_CalledCorrectlyOnReject()
Assert.Equal("Could not connect", res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseThenWithCatch_CalledCorrectlyOnReject()
{
var engine = new Engine();
Expand All @@ -280,14 +280,14 @@ public void PromiseThenWithCatch_CalledCorrectlyOnReject()
Assert.Equal("Could not connect", res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedWithHandler_ResolvedAsUndefined()
{
var engine = new Engine();
Assert.Equal(JsValue.Undefined, engine.Evaluate("Promise.reject('error').catch(() => {});").UnwrapIfPromise());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedCatchThen_ThenCallWithUndefined()
{
var engine = new Engine();
Expand All @@ -297,7 +297,7 @@ public void PromiseChainedCatchThen_ThenCallWithUndefined()
Assert.Equal(JsValue.Undefined, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedCatchWithUndefinedHandler_CatchChainedCorrectly()
{
var engine = new Engine();
Expand All @@ -307,7 +307,7 @@ public void PromiseChainedCatchWithUndefinedHandler_CatchChainedCorrectly()
Assert.Equal("Could not connect", res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseChainedFinally_HandlerCalled()
{
var engine = new Engine();
Expand All @@ -317,7 +317,7 @@ public void PromiseChainedFinally_HandlerCalled()
Assert.Equal(16, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseFinally_ReturnsNewPromiseInstance()
{
var engine = new Engine();
Expand All @@ -327,29 +327,29 @@ public void PromiseFinally_ReturnsNewPromiseInstance()
Assert.Equal(false, res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseFinally_ResolvesWithCorrectValue()
{
var engine = new Engine();
Assert.Equal(2, engine.Evaluate("Promise.resolve(2).finally(() => {})").UnwrapIfPromise());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseFinallyWithNoCallback_ResolvesWithCorrectValue()
{
var engine = new Engine();
Assert.Equal(2, engine.Evaluate("Promise.resolve(2).finally()").UnwrapIfPromise());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseFinallyChained_ResolvesWithCorrectValue()
{
var engine = new Engine();

Assert.Equal(2, engine.Evaluate("Promise.resolve(2).finally(() => 6).finally(() => 9);").UnwrapIfPromise());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseFinallyWhichThrows_ResolvesWithError()
{
var engine = new Engine();
Expand All @@ -359,31 +359,31 @@ public void PromiseFinallyWhichThrows_ResolvesWithError()
Assert.Equal("Could not connect", res);
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseAll_BadIterable_Rejects()
{
var engine = new Engine();
Assert.Throws<PromiseRejectedException>(() => { engine.Evaluate("Promise.all();").UnwrapIfPromise(); });
}


[Fact(Timeout = 5000)]
[Fact]
public void PromiseAll_ArgsAreNotPromises_ResolvesCorrectly()
{
var engine = new Engine();

Assert.Equal(new object[] {1d, 2d, 3d}, engine.Evaluate("Promise.all([1,2,3]);").UnwrapIfPromise().ToObject());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseAll_MixturePromisesNoPromises_ResolvesCorrectly()
{
var engine = new Engine();
Assert.Equal(new object[] {1d, 2d, 3d},
engine.Evaluate("Promise.all([1,Promise.resolve(2),3]);").UnwrapIfPromise().ToObject());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseAll_MixturePromisesNoPromisesOneRejects_ResolvesCorrectly()
{
var engine = new Engine();
Expand All @@ -394,47 +394,47 @@ public void PromiseAll_MixturePromisesNoPromisesOneRejects_ResolvesCorrectly()
});
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRace_NoArgs_Rejects()
{
var engine = new Engine();

Assert.Throws<PromiseRejectedException>(() => { engine.Evaluate("Promise.race();").UnwrapIfPromise(); });
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRace_InvalidIterator_Rejects()
{
var engine = new Engine();

Assert.Throws<PromiseRejectedException>(() => { engine.Evaluate("Promise.race({});").UnwrapIfPromise(); });
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRaceNoPromises_ResolvesCorrectly()
{
var engine = new Engine();

Assert.Equal(12d, engine.Evaluate("Promise.race([12,2,3]);").UnwrapIfPromise().ToObject());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRaceMixturePromisesNoPromises_ResolvesCorrectly()
{
var engine = new Engine();

Assert.Equal(12d, engine.Evaluate("Promise.race([12,Promise.resolve(2),3]);").UnwrapIfPromise().ToObject());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRaceMixturePromisesNoPromises_ResolvesCorrectly2()
{
var engine = new Engine();

Assert.Equal(2d, engine.Evaluate("Promise.race([Promise.resolve(2),6,3]);").UnwrapIfPromise().ToObject());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRaceMixturePromisesNoPromises_ResolvesCorrectly3()
{
var engine = new Engine();
Expand All @@ -443,7 +443,7 @@ public void PromiseRaceMixturePromisesNoPromises_ResolvesCorrectly3()
Assert.Equal(55d, res.ToObject());
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRaceMixturePromisesNoPromises_ResolvesCorrectly4()
{
var engine = new Engine();
Expand All @@ -455,7 +455,7 @@ public void PromiseRaceMixturePromisesNoPromises_ResolvesCorrectly4()
});
}

[Fact(Timeout = 5000)]
[Fact]
public void PromiseRegression_SingleElementArrayWithClrDictionaryInPromiseAll()
{
var engine = new Engine();
Expand Down

0 comments on commit 9fd46c3

Please sign in to comment.