Skip to content

Commit

Permalink
enable JsImportTaskTypes (#88728)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara authored Jul 12, 2023
1 parent 00ccd49 commit 2e7f0dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1505,16 +1505,20 @@ public async Task JsImportSleep()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/77334")]
public async Task JsImportTaskTypes()
{
object a = new object();
Exception e = new Exception();
JSObject j = JSHost.GlobalThis;
Assert.Equal("test", await JavaScriptTestHelper.echopromise_String("test"));
Assert.Same(a, await JavaScriptTestHelper.echopromise_Object(a));
Assert.Same(e, await JavaScriptTestHelper.echopromise_Exception(e));
Assert.Same(j, await JavaScriptTestHelper.echopromise_JSObject(j));
for(int i=0;i<100;i++)
{
object a = new object();
Exception e = new Exception();
JSObject j = JSHost.GlobalThis;
Assert.Equal("test", await JavaScriptTestHelper.echopromise_String("test"));
Assert.Same(a, await JavaScriptTestHelper.echopromise_Object(a));
Assert.Same(e, await JavaScriptTestHelper.echopromise_Exception(e));
Assert.Same(j, await JavaScriptTestHelper.echopromise_JSObject(j));
GC.Collect();
await Task.Delay(10);
}
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ export function invokeStructClassRecords(arg1) {
}

export function echopromise(arg1) {
if (globalThis.gc) {
//console.log('globalThis.gc');
globalThis.gc();
}
return new Promise(resolve => setTimeout(() => resolve(arg1), 0));
}

Expand Down

0 comments on commit 2e7f0dc

Please sign in to comment.