-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from koculu/30-bug-the-types-of-sub-namespaces…
…-are-not-accessible Fix sub namespace resolution bug.
- Loading branch information
Showing
10 changed files
with
204 additions
and
17 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
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,78 @@ | ||
using NUnit.Framework; | ||
using System.Collections; | ||
using System.Text.RegularExpressions; | ||
using Tenray.Topaz.API; | ||
|
||
namespace Tenray.Topaz.Test; | ||
|
||
public sealed class AddNamespaceTests | ||
{ | ||
[Test] | ||
public void TestAddNamespace1() | ||
{ | ||
var engine = new TopazEngine(); | ||
engine.AddNamespace("System", null, true); | ||
dynamic model = new JsObject(); | ||
engine.SetValue("model", model); | ||
engine.ExecuteScript(@" | ||
let sb = new System.Text.StringBuilder() | ||
sb.Append('1234') | ||
model.data = sb.ToString() | ||
"); | ||
Assert.That(model.data, Is.EqualTo("1234")); | ||
} | ||
|
||
[Test] | ||
public void TestAddNamespace2() | ||
{ | ||
var engine = new TopazEngine(); | ||
engine.AddNamespace("System.Text", null, true); | ||
dynamic model = new JsObject(); | ||
engine.SetValue("model", model); | ||
|
||
engine.ExecuteScript(@" | ||
let sb = new System.Text.StringBuilder() | ||
sb.Append('1234') | ||
model.data = sb.ToString() | ||
model.reg = new System.Text.RegularExpressions.Regex('\w'); | ||
"); | ||
Assert.That(model.data, Is.EqualTo("1234")); | ||
Assert.That(model.reg, Is.InstanceOf<Regex>()); | ||
} | ||
|
||
[Test] | ||
public void TestAddNamespace3() | ||
{ | ||
var engine = new TopazEngine(); | ||
engine.AddNamespace("System.Text", null, false); | ||
dynamic model = new JsObject(); | ||
engine.SetValue("model", model); | ||
|
||
engine.ExecuteScript(@" | ||
let sb = new System.Text.StringBuilder() | ||
sb.Append('1234') | ||
model.data = sb.ToString() | ||
model.reg = System.Text.RegularExpressions.Regex; | ||
"); | ||
Assert.That(model.data, Is.EqualTo("1234")); | ||
Assert.That(model.reg, Is.Null); | ||
} | ||
|
||
[Test] | ||
public void TestAddNamespace4() | ||
{ | ||
var engine = new TopazEngine(); | ||
engine.AddNamespace("System.Text", null, true); | ||
dynamic model = new JsObject(); | ||
engine.SetValue("model", model); | ||
|
||
engine.ExecuteScript(@" | ||
let sb = new System.Text.StringBuilder() | ||
sb.Append('1234') | ||
model.data = sb.ToString() | ||
model.appDomain = System.AppDomain; | ||
"); | ||
Assert.That(model.data, Is.EqualTo("1234")); | ||
Assert.That(model.appDomain, Is.Null); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -54,4 +54,4 @@ function f2(key) { | |
foreach (var item in (IEnumerable)(model.a)) | ||
Assert.IsTrue((bool)item); | ||
} | ||
} | ||
} |
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
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