Compile() public method

Compiles the given msl script file to a Script instance.
public Compile ( System file, string binPathes ) : ScriptContainer
file System The file to compile.
binPathes string
return IrcShark.Extensions.Scripting.ScriptContainer
Esempio n. 1
0
 public void Check1()
 {
     string testScript = "alias test {\n  if ($true) echo -a test\n}";
     MslScriptEngine engine = new MslScriptEngine();
     ScriptContainer script = engine.Compile("test", testScript, "Extensions\\");
     MslScript mslScript = script.Instance as MslScript;
     Assert.IsFalse(mslScript.Check(null));
     Assert.IsFalse(mslScript.Check(string.Empty));
     Assert.IsFalse(mslScript.Check(" "));
     Assert.IsFalse(mslScript.Check("0"));
     Assert.IsFalse(mslScript.Check("0.0"));
     Assert.IsFalse(mslScript.Check("$false"));
     Assert.IsTrue(mslScript.Check("a"));
     Assert.IsTrue(mslScript.Check("b"));
     Assert.IsTrue(mslScript.Check("ö"));
     Assert.IsTrue(mslScript.Check("-1"));
     Assert.IsTrue(mslScript.Check("$true"));
 }
Esempio n. 2
0
 public void Check3(
     [Values("b", "5", "foo", "10", "foobar")] string v1,
     [Values("==", "==", "==", "==", "==")] string op,
     [Values("", "4", "foobar", "10", "foobar")] string v2,
     [Values(false, false, false, true, true)] bool result)
 {
     string testScript = "alias test {\n  if ($true) echo -a test\n}";
     MslScriptEngine engine = new MslScriptEngine();
     ScriptContainer script = engine.Compile("test", testScript, "Extensions\\");
     MslScript mslScript = script.Instance as MslScript;
     if (result)
     {
         Assert.IsTrue(mslScript.Check(v1, op, v2));
     }
     else
     {
         Assert.IsFalse(mslScript.Check(v1, op, v2));
     }
 }