public void containerTest1() { var uvar = new UserVariable(); Script target = new Script(env, uvar); Assert.AreEqual("ne]", target.parse("#[var name = value\nli]ne]")); Assert.AreEqual(1, uvar.Variables.Count()); Assert.AreEqual("value\nli", uvar.get("name")); }
public void parseTest() { IEnvironment env = new net.r_eg.vsCE.Environment((EnvDTE80.DTE2)null); Script target = new Script(env, new UserVariable()); string expected = "#[( 2 > 1) { #[var name = value] } else { #[var name = value2] }]"; string actual = target.parse("##[( 2 > 1) { #[var name = value] } else { #[var name = value2] }]"); Assert.AreEqual(expected, actual); }
public void containerTest2() { var uvar = new UserVariable(); Script target = new Script(env, uvar); Assert.AreEqual(String.Empty, target.parse("#[var name = <#data>value\nli]ne</#data>]")); Assert.AreEqual(1, uvar.Variables.Count()); Assert.AreEqual("value\nli]ne", uvar.get("name")); }
public void catchTest1() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); target.parse("#[try{ $(test = '123') }catch{ $(test2 = '456') }]"); Assert.AreEqual(1, uvar.Variables.Count()); Assert.AreEqual("123", uvar.get("test", null)); }
public void catchTest2() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); Assert.AreEqual(0, uvar.Variables.Count()); target.parse("#[try{ #[notrealcomponentToError] $(test = '123') }catch{ $(test2 = '456') }]"); Assert.AreEqual(1, uvar.Variables.Count()); Assert.AreEqual("456", uvar.get("test2", null)); }
public void containerTest3() { var uvar = new UserVariable(); Script target = new Script(env, uvar); uvar.set("mx", null, "<#data>value\nli]ne</#data>"); uvar.evaluate("mx", null, new EvaluatorBlank(), true); Assert.AreEqual(String.Empty, target.parse("#[var name = #[var mx]]")); Assert.AreEqual(2, uvar.Variables.Count()); Assert.AreEqual("value\nli]ne", uvar.get("name")); }
public void catchTest3() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); Assert.AreEqual(0, uvar.Variables.Count()); target.parse(@" #[( false ){ #[try { #[notrealcomponentToError] } catch(err, msg) { $(test1 = '123') }] } else{ #[try { #[notrealcomponentToError] } catch(err, msg) { $(test2 = '456') $(exErr = $(err)) $(exMsg = $(msg)) }] }] "); Assert.AreEqual(3, uvar.Variables.Count()); Assert.AreEqual(null, uvar.get("test1", null)); Assert.AreEqual("456", uvar.get("test2", null)); Assert.AreEqual(true, !string.IsNullOrWhiteSpace(uvar.get("exErr", null))); Assert.AreEqual(true, !string.IsNullOrWhiteSpace(uvar.get("exMsg", null))); Assert.AreEqual(null, uvar.get("err", null)); Assert.AreEqual(null, uvar.get("msg", null)); }
public void parseTest2() { Script target = new Script(env, new UserVariable()); target.parse("#[NotRealComponent prop.Test]"); }
public void parseMSBuildUnloopingTest6() { var env = new StubEnv(); var uvar = new UserVariable(); var msbuild = new vsCE.MSBuild.Parser(env, uvar); var sbe = new Script(env, uvar); string data = "#[var test = #[($(test) == \""+ vsCE.MSBuild.Parser.PROP_VALUE_DEFAULT + "\"){0}else{$(test)}]]#[var test]"; Assert.AreEqual("0", msbuild.parse(sbe.parse(data, true))); Assert.AreEqual("0", msbuild.parse(sbe.parse(data, true))); uvar.set("test", null, "7"); uvar.evaluate("test", null, new EvaluatorBlank(), true); Assert.AreEqual("7", msbuild.parse(sbe.parse(data, true))); }
public void parseMSBuildUnloopingTest5() { var env = new StubEnv(); var uvar = new UserVariable(); var msbuild = new vsCE.MSBuild.Parser(env, uvar); var sbe = new Script(env, uvar); msbuild.parse(sbe.parse("#[var test = $$(test)]#[var test = 1 $(test) 2]", true)); uvar.unsetAll(); msbuild.parse(sbe.parse("#[var test = $$(test)]#[var test = 1 $(test.Replace('1', '2')) 2]", true)); uvar.unsetAll(); msbuild.parse(sbe.parse("#[var test = $(test)]#[var test = 1 $(test) 2]", true)); }
public void stDataTest5() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); uvar.set("p1", null, "ab!"); uvar.evaluate("p1", null, new EvaluatorBlank(), true); Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test1\", false): $(p1) ]")); Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test2\", true): $(p1) ]")); Assert.AreEqual("$(p1)$(p1)$(p1)$(p1)", noSpaces("#[Box data.clone(\"test1\", 4)]", target)); Assert.AreEqual("$(p1)$(p1)$(p1)$(p1)", noSpaces("#[Box data.clone(\"test1\", 4, false)]", target)); Assert.AreEqual("ab!ab!ab!ab!", noSpaces("#[Box data.clone(\"test1\", 4, true)]", target)); Assert.AreEqual("ab!ab!", noSpaces("#[Box data.clone(\"test2\", 2)]", target)); Assert.AreEqual("ab!ab!", noSpaces("#[Box data.clone(\"test2\", 2, false)]", target)); Assert.AreEqual("ab!ab!", noSpaces("#[Box data.clone(\"test2\", 2, true)]", target)); Assert.AreEqual(String.Empty, noSpaces("#[Box data.clone(\"test2\", 0)]", target)); }
public void parseTest5() { uvariable.unsetAll(); Script target = new Script(env, uvariable); target.parse("#[( 2 < 1) { #[var name = value] } else { #[var name = value2] }]"); Assert.AreEqual(1, uvariable.Variables.Count()); foreach(TUserVariable uvar in uvariable.Variables) { Assert.AreEqual(uvar.ident, "name"); Assert.AreEqual(uvar.unevaluated, "value2"); } }
public void selectorTest1() { var target = new Script(new StubEnv(), new UserVariable()); var dom = new Inspector(target.Bootloader); // Compliance Test - entry point to component + CRegex flag foreach(var c in dom.Root) { try { target.parse(String.Format("#[{0} ]", c.Name)); } catch(SelectorMismatchException ex) { Assert.Fail("`{0}` <- `{1}`", c.Name, ex.Message); } catch { } } }
public void opSleepTest2() { var target = new Script(new StubEnv(), new UserVariable()); target.parse(@"#[Box operators.notrealProperty]"); }
public void stDataTest1() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); uvar.set("p1", null, "v1"); uvar.evaluate("p1", null, new EvaluatorBlank(), true); Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test1\", false): $(p1)#[Box operators.sleep(10)] ]")); Assert.AreEqual(String.Empty, target.parse("#[Box data.pack(\"test2\", true): $(p1) #[Box operators.sleep(10)] ]")); Assert.AreEqual("$(p1)#[Box operators.sleep(10)]", target.parse("#[Box data.get(\"test1\", false)]").Trim()); Assert.AreEqual("v1", noSpaces("#[Box data.get(\"test1\", true)]", target)); Assert.AreEqual("v1", noSpaces("#[Box data.get(\"test2\", false)]", target)); Assert.AreEqual("v1", noSpaces("#[Box data.get(\"test2\", true)]", target)); }
public void iterateTest6() { var target = new Script(new StubEnv(), new UserVariable()); target.parse(@"#[Box iterate(; i = 1; $(i) < 4; i = $([MSBuild]::Add($(i), 1)) ): ]"); }
public void opSleepTest1() { var target = new Script(new StubEnv(), new UserVariable()); target.parse(@"#[Box operators.sleep()]"); }
public void stDataTest9() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); Assert.AreEqual(String.Empty, target.parse("#[Box data.free(\"test1\")]")); Assert.AreEqual(String.Empty, target.parse("#[Box data.free(\"test2\")]")); }
public void stDataTest8() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); target.parse("#[Box data.free(\"test1\"): 123]"); }
public void stDataTest6() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); target.parse("#[Box data.clone(\"notexists\", 4)]"); }
public void parseTest3() { Script target = new Script(env, new UserVariable()); Assert.AreEqual("[( 2 > 1) { body }]", target.parse("[( 2 > 1) { body }]")); Assert.AreEqual("( 2 > 1) { body }", target.parse("( 2 > 1) { body }")); Assert.AreEqual(" test ", target.parse(" test ")); Assert.AreEqual("", target.parse("")); Assert.AreEqual(" \"test\" ", target.parse(" \"test\" ")); }
public void parseTest1() { var target = new Script(new StubEnv(), new UserVariable()); target.parse(@"#[Box notrealnode]"); }
public void parseTest4() { Script target = new Script(env, new UserVariable()); Assert.AreEqual("B4 ", target.parse("#[(true) {\n #[(1 > 2){ B3 } \n else {B4} ] } else {\n B2 }]")); }
public void containerTest9() { var uvar = new UserVariable(); Script target = new Script(env, uvar); Assert.AreEqual("test - cc", target.parse("#[var sres = <#data>Data1\n\nEnd</#data>]test - cc#[var sres2 = <#data>Data2\n\nEnd</#data>]")); Assert.AreEqual(2, uvar.Variables.Count()); Assert.AreEqual("Data1\n\nEnd", uvar.get("sres")); Assert.AreEqual("Data2\n\nEnd", uvar.get("sres2")); }
public void parseTest6() { uvariable.unsetAll(); Script target = new Script(env, uvariable); Assert.AreEqual(String.Empty, target.parse("#[\" #[var name = value] \"]")); Assert.AreEqual(0, uvariable.Variables.Count()); }
public void parseMSBuildUnloopingTest2() { var env = new StubEnv(); var uvar = new UserVariable(); var msbuild = new vsCE.MSBuild.Parser(env, uvar); var sbe = new Script(env, uvar); msbuild.parse(sbe.parse("#[var p1 = $$(p4)]#[var p2 = $$(p3)]#[var p3 = $$(p1)]#[var p4 = $(p2)]", true)); }
public void opSleepTest3() { var target = new Script(new StubEnv(), new UserVariable()); var start = DateTime.Now; target.parse(@"#[Box operators.sleep(1000)]"); var end = DateTime.Now; Assert.IsTrue((end - start).TotalMilliseconds >= 1000); }
public void parseMSBuildUnloopingTest4() { var env = new StubEnv(); var uvar = new UserVariable(); var msbuild = new vsCE.MSBuild.Parser(env, uvar); var sbe = new Script(env, uvar); msbuild.parse(sbe.parse("#[var p2 = $$(p1) to $$(p8), and new ($$(p7.Replace('1', '2'))) s$$(p9)]#[var p6 = $$(p2)]#[var p7 = $$(p5)]#[var p5 = $(p6)]", true)); Assert.IsTrue(true); // no problems for stack & heap }
public void containerTest7() { var uvar = new UserVariable(); Script target = new Script(env, uvar); Assert.AreEqual("#[var name = left [box1 right]", target.parse("#[var name = left [box1 right]")); Assert.AreEqual(0, uvar.Variables.Count()); Assert.AreEqual(String.Empty, target.parse("#[var name = \"left [box1 right\"]")); Assert.AreEqual(1, uvar.Variables.Count()); Assert.AreEqual("\"left [box1 right\"", uvar.get("name")); }
public void stDataTest2() { var uvar = new UserVariable(); var target = new Script(new StubEnv(), uvar); target.parse("#[Box data.pack(\"test1\", false): 123]"); target.parse("#[Box data.pack(\"test1\", true): 123]"); }