|
|
@@ -22,7 +22,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
return new RValue(1234.0);
|
|
|
}));
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, globalCtx).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(globalCtx);
|
|
|
|
|
|
Assert.AreEqual(DataType.Nil, res.Type);
|
|
|
Assert.AreEqual(2, args.Length);
|
|
|
@@ -43,7 +43,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
var globalCtx = new Table();
|
|
|
globalCtx[new RValue("print")] = new RValue(new CallbackFunction(a => { args = a; return new RValue(1234.0); }));
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, globalCtx).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(globalCtx);
|
|
|
|
|
|
Assert.AreEqual(2, args.Length);
|
|
|
Assert.AreEqual(DataType.String, args[0].Type);
|
|
|
@@ -68,7 +68,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return x,y,z";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(3, res.Tuple.Length);
|
|
|
Assert.AreEqual(DataType.String, res.Tuple[0].Type);
|
|
|
@@ -84,7 +84,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
{
|
|
|
string script = @"return 6*7";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(42, res.Number);
|
|
|
@@ -105,7 +105,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
throw new Exception("FAIL!");
|
|
|
}));
|
|
|
|
|
|
- MoonSharpInterpreter.LoadFromString(script, globalCtx).Execute();
|
|
|
+ MoonSharpInterpreter.LoadFromString(script).Execute(globalCtx);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -125,7 +125,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return false or f(), true or f(), false and f(), true and f(), i";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(5, res.Tuple.Length);
|
|
|
Assert.AreEqual(DataType.String, res.Tuple[0].Type);
|
|
|
@@ -153,7 +153,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
move(4, 1, 2, 3)
|
|
|
";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
@@ -171,7 +171,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return fact(5)";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(120.0, res.Number);
|
|
|
@@ -190,7 +190,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return i, x";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(2, res.Tuple.Length);
|
|
|
@@ -211,7 +211,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return i, x";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(2, res.Tuple.Length);
|
|
|
@@ -233,7 +233,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return x";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(1, res.Number);
|
|
|
@@ -272,7 +272,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return x, y";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(2, res.Tuple.Length);
|
|
|
@@ -311,7 +311,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return x, y";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(2, res.Tuple.Length);
|
|
|
@@ -330,7 +330,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return #x, #y";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(2, res.Tuple.Length);
|
|
|
@@ -357,7 +357,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return i, x";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(2, res.Tuple.Length);
|
|
|
@@ -380,7 +380,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return fact(5)";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(120.0, res.Number);
|
|
|
@@ -391,7 +391,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
{
|
|
|
string script = @"return 5+3*7-2*5+2^3^2";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(528, res.Number);
|
|
|
@@ -402,7 +402,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
{
|
|
|
string script = @"return (5+3)*7-2*5+(2^3)^2";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(110, res.Number);
|
|
|
@@ -413,7 +413,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
{
|
|
|
string script = @"x = 1; return x;";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(1, res.Number);
|
|
|
@@ -434,7 +434,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return w+x+y+z";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(6, res.Number);
|
|
|
@@ -455,7 +455,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return fact(5)";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(120.0, res.Number);
|
|
|
@@ -479,7 +479,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return fact(5)";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(120.0, res.Number);
|
|
|
@@ -498,7 +498,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
return x;
|
|
|
";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(6.0, res.Number);
|
|
|
@@ -514,7 +514,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return fact(3)";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(3, res.Number);
|
|
|
@@ -536,7 +536,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
|
|
|
return fact(5)";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Number, res.Type);
|
|
|
Assert.AreEqual(120.0, res.Number);
|
|
|
@@ -554,7 +554,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
return fact();
|
|
|
";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Function, res.Type);
|
|
|
}
|
|
|
@@ -575,7 +575,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
";
|
|
|
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.String, res.Type);
|
|
|
Assert.AreEqual("ciao", res.String);
|
|
|
@@ -598,7 +598,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
";
|
|
|
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Table, res.Type);
|
|
|
|
|
|
@@ -619,7 +619,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
";
|
|
|
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
Assert.AreEqual(DataType.Tuple, res.Type);
|
|
|
Assert.AreEqual(DataType.Number, res.Tuple[0].Type);
|
|
|
@@ -641,7 +641,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
Allowed();
|
|
|
";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
}
|
|
|
[Test]
|
|
|
@@ -658,7 +658,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
Allowed();
|
|
|
";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -679,7 +679,7 @@ namespace MoonSharp.Interpreter.Tests
|
|
|
Allowed();
|
|
|
";
|
|
|
|
|
|
- RValue res = MoonSharpInterpreter.LoadFromString(script, null).Execute();
|
|
|
+ RValue res = MoonSharpInterpreter.LoadFromString(script).Execute(null);
|
|
|
|
|
|
}
|
|
|
|