From ed63109006adfdaa6d102292aa1f6ee82e80116e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Deml?= Date: Tue, 12 Feb 2019 09:49:18 +0100 Subject: [PATCH] (Failing) Test to verify that embedded delegates are linked to the `Function` prototype --- .../ChakraCore/InteropTests.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs index 95c72e86..8eebb27c 100644 --- a/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs +++ b/test/JavaScriptEngineSwitcher.Tests/ChakraCore/InteropTests.cs @@ -1,4 +1,7 @@ -namespace JavaScriptEngineSwitcher.Tests.ChakraCore +using System; +using Xunit; + +namespace JavaScriptEngineSwitcher.Tests.ChakraCore { public class InteropTests : InteropTestsBase { @@ -6,5 +9,26 @@ protected override string EngineName { get { return "ChakraCoreJsEngine"; } } + + [Fact] + public void EmbeddedInstanceOfDelegateHasFunctionPrototype() + { + // Arrange + var someFunc = new Func(() => 42); + + const string input = "Object.getPrototypeOf(embeddedFunc) === Function.prototype"; + + // Act + bool output; + + using (var jsEngine = CreateJsEngine()) + { + jsEngine.EmbedHostObject("embeddedFunc", someFunc); + output = jsEngine.Evaluate(input); + } + + // Assert + Assert.True(output); + } } } \ No newline at end of file