public void evaluateTest6()
        {
            UserVariable target  = new UserVariable();
            string       name    = "name";
            string       project = "project";

            target.set(name, project, "val");
            target.evaluate(name, project, new Evaluator1(), true);
            target.evaluate(name, project, new Evaluator2(), true);
            Assert.AreEqual("[E2:val]", target.get(name, project));
        }
        public void evaluateTest3()
        {
            UserVariable target  = new UserVariable();
            string       name    = "name";
            string       project = "project";

            target.set(name, project, "val");
            target.evaluate(name, project, null, true);
        }
Example #3
0
        public void containerTest5()
        {
            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 quotesTest9()
        {
            var uvar   = new UserVariable();
            var target = new Parser(new StubEnv(), uvar);

            uvar.set("lp", null, "\"s3\\dir\"");
            uvar.evaluate("lp", null, new EvaluatorBlank(), true);
            Assert.AreEqual("\"s3\\dir\"", uvar.get("lp", null));

            //Assert.AreEqual("\"\"s3\\dir\"\\p1.exe\"", target.parse("\"$(lp)\\p1.exe\"")); // ? TODO: unspecified for current time
            Assert.AreEqual("'$(lp)\\p2.exe'", target.parse("'$(lp)\\p2.exe'"));
            Assert.AreEqual("\"s3\\dir\"\\p3.exe", target.parse("$(lp)\\p3.exe"));
        }
        public void quotesTest7()
        {
            var uvar   = new UserVariable();
            var target = new Parser(new StubEnv(), uvar);

            uvar.set("lp", null, "s1\\dir");
            uvar.evaluate("lp", null, new EvaluatorBlank(), true);
            Assert.AreEqual("s1\\dir", uvar.get("lp", null));

            Assert.AreEqual("\"s1\\dir\\p1.exe\"", target.parse("\"$(lp)\\p1.exe\""));
            Assert.AreEqual("'$(lp)\\p2.exe'", target.parse("'$(lp)\\p2.exe'"));
            Assert.AreEqual("s1\\dir\\p3.exe", target.parse("$(lp)\\p3.exe"));
        }
Example #6
0
        public void parseMSBuildUnloopingTest6()
        {
            var env     = new StubEnv();
            var uvar    = new UserVariable();
            var msbuild = new vsSBE.MSBuild.Parser(env, uvar);
            var sbe     = new Script(env, uvar);

            string data = "#[var test = #[($(test) == \"" + vsSBE.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 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 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 evaluateTest2()
        {
            UserVariable target = new UserVariable();

            target.evaluate("name", new Evaluator1(), true);
        }