public void DefTest1() { UVars target = new UVars(); Assert.Empty(target.Definitions); Assert.Empty(target.Variables); }
public void IsExistTest3() { UVars target = new UVars(); target.SetVariable("name", "project", "val"); Assert.True(target.IsExist("name", "project")); }
public void GetTest1() { UVars target = new UVars(); Assert.Null(target.GetValue("name")); Assert.Null(target.GetValue("name", "project")); }
public void GetTest3() { UVars target = new UVars(); target.SetVariable("name", null, "val"); Assert.Equal(string.Empty, target.GetValue("name")); }
public void CatchTest5() { var uvar = new UVars(); var target = SobaAcs.MakeWithTryComponent(uvar); Assert.Empty(uvar.Variables); target.Eval(@" #[try { #[notrealcomponentToError] #[( true ){ $(test1 = '123') }] } catch { #[( true ){ $(test2 = '456') }] }] "); Assert.Single(uvar.Variables); Assert.Null(uvar.GetValue("test1", null)); Assert.Equal("456", uvar.GetValue("test2", null)); }
public void IsUnevaluatedTest2() { UVars target = new UVars(); target.SetVariable("name", null, "val"); Assert.True(target.IsUnevaluated("name")); }
public override string GetPropValue(string name, string project) { if (UVars.IsExist(name, project)) { return(GetUVarValue(name, project)); } return($"[P~{name}~{project}]"); }
public void IsUnevaluatedTest3() { var target = new UVars(); target.SetVariable("name", "project", "val"); Assert.True(target.IsUnevaluated("name", "project")); }
public void SetTest5() { var target = new UVars(); Assert.Throws <ArgumentException>(() => { target.SetVariable("na%me", "project", "unevaluated"); }); }
public void StDataTest9() { var uvar = new UVars(); var target = SobaAcs.MakeWithBoxComponent(uvar); Assert.Equal(string.Empty, target.Eval("#[Box data.free(\"test1\")]")); Assert.Equal(string.Empty, target.Eval("#[Box data.free(\"test2\")]")); }
public void UnsetAllTest1() { UVars target = new UVars(); target.SetVariable("name", null, "unevaluated"); target.UnsetAll(); Assert.Empty(target.Variables); }
public void ContainerTest1() { var uvar = new UVars(); var target = SobaAcs.MakeNewCoreOnly(uvar); Assert.Equal("ne]", target.Eval("#[var name = value\nli]ne]")); Assert.Single(uvar.Variables); Assert.Equal("value\nli", uvar.GetValue("name")); }
public void ContainerTest2() { var uvar = new UVars(); var target = SobaAcs.MakeNewCoreOnly(uvar); Assert.Equal(string.Empty, target.Eval("#[var name = <#data>value\nli]ne</#data>]")); Assert.Single(uvar.Variables); Assert.Equal("value\nli]ne", uvar.GetValue("name")); }
public void ParseMSBuildUnloopingTest3() { var uvar = new UVars(); var msbuild = new EvMSBuilder(uvar); var sbe = SobaAcs.MakeNewCoreOnly(uvar); msbuild.Eval(sbe.Eval("#[var p2 = $$(p1)]#[var p6 = $$(p2)]#[var p7 = $$(p5)]#[var p5 = $(p6)]", true)); // shouldn't throw LimitException, ie. no problems for stack & heap }
public void ContainerTest6() { var uvar = new UVars(); var target = SobaAcs.MakeNewCoreOnly(uvar); Assert.Equal(string.Empty, target.Eval("#[var name = left [box1] right]")); Assert.Single(uvar.Variables); Assert.Equal("left [box1] right", uvar.GetValue("name")); }
public void StDataTest6() { var uvar = new UVars(); var target = SobaAcs.MakeWithBoxComponent(uvar); Assert.Throws <NotFoundException>(() => target.Eval("#[Box data.clone(\"notexists\", 4)]") ); }
public void StDataTest8() { var uvar = new UVars(); var target = SobaAcs.MakeWithBoxComponent(uvar); Assert.Throws <NotSupportedOperationException>(() => target.Eval("#[Box data.free(\"test1\"): 123]") ); }
public void ParseTest1() { var uvar = new UVars(); var target = new TryComponent(SobaAcs.MakeWithTryComponent(uvar)); Assert.Equal(Value.Empty, target.Eval("[try{}catch{ if error }]")); Assert.Equal(Value.Empty, target.Eval("[try{}catch(err, msg){ if error }]")); Assert.Equal(Value.Empty, target.Eval("[try{}catch(){ }]")); Assert.Empty(uvar.Variables); }
public void EvaluateTest3() { UVars target = new UVars(); string name = "name"; string project = "project"; target.SetVariable(name, project, "val"); target.Evaluate(name, project, new Evaluator1(), true); Assert.Equal("[E1:val]", target.GetValue(name, project)); }
public void CatchTest1() { var uvar = new UVars(); var target = SobaAcs.MakeWithTryComponent(uvar); target.Eval("#[try{ $(test = '123') }catch{ $(test2 = '456') }]"); Assert.Single(uvar.Variables); Assert.Equal("123", uvar.GetValue("test", null)); }
public void ParseMSBuildUnloopingTest2() { var uvar = new UVars(); var msbuild = new EvMSBuilder(uvar); var sbe = SobaAcs.MakeNewCoreOnly(uvar); Assert.Throws <net.r_eg.Varhead.Exceptions.LimitException>(() => msbuild.Eval(sbe.Eval("#[var p1 = $$(p4)]#[var p2 = $$(p3)]#[var p3 = $$(p1)]#[var p4 = $(p2)]", true)) ); }
public void ParseMSBuildUnloopingTest4() { var uvar = new UVars(); var msbuild = new EvMSBuilder(uvar); var sbe = SobaAcs.MakeNewCoreOnly(uvar); Assert.Throws <net.r_eg.Varhead.Exceptions.LimitException>(() => msbuild.Eval(sbe.Eval("#[var p2 = $$(p1) to $$(p8), and new ($$(p7.Replace('1', '2'))) s$$(p9)]#[var p6 = $$(p2)]#[var p7 = $$(p5)]#[var p5 = $(p6)]", true)) ); }
private Bootloader(IEnvironment env) { Env = env ?? throw new ArgumentNullException(nameof(env)); UVars = new UVars(); Soba = Configure( new Soba(MSBuild.MakeEvaluator(env, UVars), UVars) ); }
public void ContainerTest9() { var uvar = new UVars(); var target = SobaAcs.MakeNewCoreOnly(uvar); Assert.Equal("test - cc", target.Eval("#[var sres = <#data>Data1\n\nEnd</#data>]test - cc#[var sres2 = <#data>Data2\n\nEnd</#data>]")); Assert.Equal(2, uvar.Variables.Count()); Assert.Equal("Data1\n\nEnd", uvar.GetValue("sres")); Assert.Equal("Data2\n\nEnd", uvar.GetValue("sres2")); }
public void VtSignTest2() { var uvar = new UVars(); var target = new EvMSBuilder(new EnvStub(), uvar); Assert.Equal(string.Empty, target.Eval("$(i = 0)")); Assert.Equal(string.Empty, target.Eval("$(i += 1)")); Assert.Equal(string.Empty, target.Eval("$(i += 2)$(i += 1)")); Assert.Equal(string.Empty, target.Eval("$(i -= 2)")); Assert.Equal("2", uvar.GetValue("i")); }
public void StDataTest2() { var uvar = new UVars(); var target = SobaAcs.MakeWithBoxComponent(uvar); target.Eval("#[Box data.pack(\"test1\", false): 123]"); Assert.Throws <LimitException>(() => target.Eval("#[Box data.pack(\"test1\", true): 123]") ); }
public void VtSignTest3() { var uvar = new UVars(); var target = new EvMSBuilder(new EnvStub(), uvar); Assert.Equal(string.Empty, target.Eval("$(i += 1)")); Assert.Equal("1", uvar.GetValue("i")); Assert.Equal(string.Empty, target.Eval("$(j -= 1)")); Assert.Equal("-1", uvar.GetValue("j")); }
public void StDataTest7() { var uvar = new UVars(); var target = SobaAcs.MakeWithBoxComponent(uvar); Assert.Equal(string.Empty, target.Eval("#[Box data.pack(\"test1\", false): 123 ]")); Assert.Equal(string.Empty, target.Eval("#[Box data.free(\"test1\")]")); Assert.Throws <NotFoundException>(() => target.Eval("#[Box data.get(\"test1\", false)]") ); }
public void EvaluateTest2() { UVars target = new UVars(); string name = "name"; string project = "project"; Assert.Throws <ArgumentNullException>(() => { target.SetVariable(name, project, "val"); target.Evaluate(name, project, null, true); }); }
public void EvaluateTest1() { UVars target = new UVars(); Assert.Throws <DefinitionNotFoundException>(() => { target.Evaluate("name", "project", new Evaluator1(), true); }); Assert.Throws <DefinitionNotFoundException>(() => { target.Evaluate("name", new Evaluator1(), true); }); }