Esempio n. 1
0
        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"));
        }
Esempio n. 2
0
        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"));
        }
Esempio n. 3
0
        public void QuotesTest7()
        {
            var uvar   = new UVars();
            var target = new EvMSBuilder(new EnvStub(), uvar);

            uvar.SetVariable("lp", null, "s1\\dir");
            uvar.Evaluate("lp", null, new EvaluatorBlank(), true);
            Assert.Equal("s1\\dir", uvar.GetValue("lp", null));

            Assert.Equal("\"s1\\dir\\p1.exe\"", target.Eval("\"$(lp)\\p1.exe\""));
            Assert.Equal("'$(lp)\\p2.exe'", target.Eval("'$(lp)\\p2.exe'"));
            Assert.Equal("s1\\dir\\p3.exe", target.Eval("$(lp)\\p3.exe"));
        }
Esempio n. 4
0
        public void QuotesTest9()
        {
            var uvar   = new UVars();
            var target = new EvMSBuilder(new EnvStub(), uvar);

            uvar.SetVariable("lp", null, "\"s3\\dir\"");
            uvar.Evaluate("lp", null, new EvaluatorBlank(), true);
            Assert.Equal("\"s3\\dir\"", uvar.GetValue("lp", null));

            //Assert.Equal("\"\"s3\\dir\"\\p1.exe\"", target.parse("\"$(lp)\\p1.exe\"")); // ? TODO: unspecified for current time
            Assert.Equal("'$(lp)\\p2.exe'", target.Eval("'$(lp)\\p2.exe'"));
            Assert.Equal("\"s3\\dir\"\\p3.exe", target.Eval("$(lp)\\p3.exe"));
        }
Esempio n. 5
0
        public void VtSignTest5()
        {
            var uvar   = new UVars();
            var target = new EvMSBuilder(new EnvStub(), uvar);

            Assert.Equal(string.Empty, target.Eval("$(i = 1)"));
            Assert.Equal(string.Empty, target.Eval("$(i += $(i))"));
            Assert.Equal("2", uvar.GetValue("i"));

            //Assert.Equal(string.Empty, target.parse("$(i += '2')"));

            Assert.ThrowsAny <Exception>(() => target.Eval("$(i += 'test')"));
        }
Esempio n. 6
0
        public void VtSignTest4()
        {
            var uvar   = new UVars();
            var target = new EvMSBuilder(new EnvStub(), uvar);

            Assert.Equal(string.Empty, target.Eval("$(i = \"test\")"));
            Assert.Equal(string.Empty, target.Eval("$(i += 1)"));
            Assert.Equal("test1", uvar.GetValue("i"));

            Assert.Throws <ArgumentException>(() =>
            {
                target.Eval("$(i -= 1)");
            });
        }
Esempio n. 7
0
        public void VtSignTest1()
        {
            var uvar   = new UVars();
            var target = new EvMSBuilder(new EnvStub(), uvar);

            Assert.Equal(string.Empty, target.Eval("$(+name = 'myvar')"));
            Assert.Equal("myvar", uvar.GetValue("name"));

            Assert.Equal(string.Empty, target.Eval("$(+name += '12')"));
            Assert.Equal("myvar12", uvar.GetValue("name"));

            Assert.Equal(string.Empty, target.Eval("$(name += '34')"));
            Assert.Equal("myvar1234", uvar.GetValue("name"));
        }
Esempio n. 8
0
        public void ParseMSBuildUnloopingTest6()
        {
            var uvar    = new UVars();
            var msbuild = new EvMSBuilder(uvar);
            var sbe     = SobaAcs.MakeNewCoreOnly(uvar);

            string data = "#[var test = #[($(test) == \"" + EvMSBuilder.UNDEF_VAL + "\"){0}else{$(test)}]]#[var test]";

            Assert.Equal("0", msbuild.Eval(sbe.Eval(data, true)));
            Assert.Equal("0", msbuild.Eval(sbe.Eval(data, true)));

            uvar.SetVariable("test", null, "7");
            uvar.Evaluate("test", null, new EvaluatorBlank(), true);
            Assert.Equal("7", msbuild.Eval(sbe.Eval(data, true)));
        }
Esempio n. 9
0
        public void ParseMSBuildUnloopingTest5()
        {
            var uvar    = new UVars();
            var msbuild = new EvMSBuilder(uvar);
            var sbe     = SobaAcs.MakeNewCoreOnly(uvar);

            msbuild.Eval(sbe.Eval("#[var test = $$(test)]#[var test = 1 $(test) 2]", true));

            uvar.UnsetAll();
            msbuild.Eval(sbe.Eval("#[var test = $$(test)]#[var test = 1 $(test.Replace('1', '2')) 2]", true));

            uvar.UnsetAll();
            msbuild.Eval(sbe.Eval("#[var test = $(test)]#[var test = 1 $(test) 2]", true));

            // shouldn't throw LimitException, ie. no problems for stack & heap
        }
Esempio n. 10
0
        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
        }
Esempio n. 11
0
        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))
                                                                       );
        }
Esempio n. 12
0
        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))
                                                                       );
        }