Skip to content

Commit b59eb30

Browse files
authored
Merge pull request #67 from tomasdeml/bug/embedded-delegate-missing-prototype
Verify that embedded delegates are linked to the `Function` prototype
2 parents 4b58f36 + ed63109 commit b59eb30

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
1-
namespace JavaScriptEngineSwitcher.Tests.ChakraCore
1+
using System;
2+
using Xunit;
3+
4+
namespace JavaScriptEngineSwitcher.Tests.ChakraCore
25
{
36
public class InteropTests : InteropTestsBase
47
{
58
protected override string EngineName
69
{
710
get { return "ChakraCoreJsEngine"; }
811
}
12+
13+
[Fact]
14+
public void EmbeddedInstanceOfDelegateHasFunctionPrototype()
15+
{
16+
// Arrange
17+
var someFunc = new Func<int>(() => 42);
18+
19+
const string input = "Object.getPrototypeOf(embeddedFunc) === Function.prototype";
20+
21+
// Act
22+
bool output;
23+
24+
using (var jsEngine = CreateJsEngine())
25+
{
26+
jsEngine.EmbedHostObject("embeddedFunc", someFunc);
27+
output = jsEngine.Evaluate<bool>(input);
28+
}
29+
30+
// Assert
31+
Assert.True(output);
32+
}
933
}
1034
}

0 commit comments

Comments
 (0)