-
-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some interop tests to the public interface test project (#1767)
most of those interop tests illustrate how to interact with objects from popular libraries such as Newtonsoft.Json, System.Text.Json and dynamic objects such as ExpandoObject. because this can be a valuable reference for Jint users, they should not depend on any internals (which would be off limits for callers.)
- Loading branch information
Showing
6 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Jint.Tests/Runtime/InteropTests.Json.cs → ...ests.PublicInterface/InteropTests.Json.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Reflection; | ||
|
||
namespace Jint.Tests.PublicInterface | ||
{ | ||
public partial class InteropTests : IDisposable | ||
{ | ||
private readonly Engine _engine; | ||
|
||
public InteropTests() | ||
{ | ||
_engine = new Engine(cfg => cfg.AllowClr( | ||
typeof(Console).GetTypeInfo().Assembly, | ||
typeof(File).GetTypeInfo().Assembly)) | ||
.SetValue("log", new Action<object>(Console.WriteLine)) | ||
.SetValue("assert", new Action<bool>(Assert.True)) | ||
.SetValue("equal", new Action<object, object>(Assert.Equal)) | ||
; | ||
} | ||
|
||
void IDisposable.Dispose() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters