Skip to content

Commit ebde4e9

Browse files
committed
improve test for #309
1 parent 1bb0bf8 commit ebde4e9

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

Tests/Fuzz/Bug_309.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,23 @@ public class Bug_309
1313
[TestMethod]
1414
public void SetField91()
1515
{
16-
var context = new Context();
16+
var globalContext = new GlobalContext();
17+
try
18+
{
19+
globalContext.ActivateInCurrentThread();
20+
var context = new Context();
1721

18-
context.GlobalContext.IndexersSupport = IndexersSupport.ForceEnable;
19-
_ = context.GlobalContext.GetConstructor(typeof(Dictionary<string, string>));
20-
context.GlobalContext.IndexersSupport = IndexersSupport.WithAttributeOnly;
22+
context.GlobalContext.IndexersSupport = IndexersSupport.ForceEnable;
23+
_ = context.GlobalContext.GetConstructor(typeof(Dictionary<string, string>));
24+
context.GlobalContext.IndexersSupport = IndexersSupport.WithAttributeOnly;
2125

22-
context.Add("test", new Dictionary<string, string> { ["myKey"] = "myValue" });
26+
context.Add("test", new Dictionary<string, string> { ["myKey"] = "myValue" });
2327

24-
Assert.AreEqual(context.Eval("test.myKey").ToString(), "myValue");
28+
Assert.AreEqual("myValue", context.Eval("test.myKey").ToString());
29+
}
30+
finally
31+
{
32+
globalContext.Deactivate();
33+
}
2534
}
2635
}

0 commit comments

Comments
 (0)