public void StringPlain() { var s = new StringValue("hi"); var mys = s.Evaluate(new RootContext()); Assert.AreEqual("hi", mys, "Plain string value"); }
public void StringWithVarNoTrans() { var s = new StringValue("hi {there}"); var mys = s.Evaluate(new RootContext()); Assert.AreEqual("hi {there}", mys, "string value"); }
public void StringWithBadExpr() { var s = new StringValue("hi {1+}"); var c = new RootContext(); var mys = s.Evaluate(c); Assert.AreEqual("hi {1+}", mys); }
public void StringWith1CharVar() { var s = new StringValue("hi {t}"); var c = new RootContext(); c.SetVariableValue("t", "dude"); var mys = s.Evaluate(c); Assert.AreEqual("hi dude", mys, "string value"); }
public void StringWithOpenBAndValue() { var s = new StringValue("hi{there"); var c = new RootContext(); c.SetVariableValue("there", "dude"); var mys = s.Evaluate(c); Assert.AreEqual("hi{there", mys, "string value"); }
public void StringWith2VarNextToEachOtherOneNoTrans() { var s = new StringValue("hi {there}{t}"); var c = new RootContext(); c.SetVariableValue("t", "dude"); var mys = s.Evaluate(c); Assert.AreEqual("hi {there}dude", mys, "string value"); }
public void StringWithDictReference() { var allvals = new Tuple <IExpression, IExpression>[] { new Tuple <IExpression, IExpression>(new StringValue("hi"), new StringValue("there")), new Tuple <IExpression, IExpression>(new StringValue("no"), new StringValue("way")), }; var d = new Dictionary <object, object>(); d["hi"] = "there"; d["no"] = "way"; var c = new RootContext(); //c.SetVariableValue("dict", new DictionaryValue(allvals)); c.SetVariableValue("dict", d); var s = new StringValue("hi {dict[\"hi\"]} on my {dict[\"no\"]}."); var mys = s.Evaluate(c); Assert.AreEqual("hi there on my way.", mys); }
static public object GetMeWithIndex2(StringValue expr) { var r = new RootContext(); return(expr.Evaluate(r)); }