예제 #1
0
 public void Can_call_native_function_without_args()
 {
     _t.Runtime.RegisterFunction("test.hello", GetType().GetMethod("TestHello"), new DekiScriptNativeInvocationTarget.Parameter[0]);
     _t.Test(
         "test.hello();",
         "hello",
         typeof(DekiScriptString),
         false
         );
 }
예제 #2
0
 public void Apply()
 {
     _t.Test(
         @"var x = { ""a"":""b"", 1:4 }; map.apply(x, ""$.value+5"");",
         @"{ 1 : 9, a : nil }",
         typeof(DekiScriptMap)
         );
 }
예제 #3
0
        public void Can_call_iterator_on_list_to_build_list()
        {
            _t.Test(@"
var x = [1,2,3];
[ (v2)
    foreach 
        var v in x,
        var v2 = v*v
];",
                    "[ 1, 4, 9 ]",
                    typeof(DekiScriptList));
        }
예제 #4
0
 public void Date()
 {
     _t.Test(
         "xml.date(web.xml(\"" + testXml + "\"), \"somedata/date\");",
         @"Sat, 01 Jan 2000 08:00:00 GMT",
         typeof(DekiScriptString)
         );
 }
예제 #5
0
 public void Can_call_ListApply()
 {
     _t.Test(
         "list.apply([1,2,3,4],\"$+$\")",
         "[ 2, 4, 6, 8 ]",
         typeof(DekiScriptList));
 }
예제 #6
0
 public void Definition_Assignment()
 {
     _dekiScriptTester.Test("var x = 5; let x = 10; x;", "10", typeof(DekiScriptNumber));
 }
예제 #7
0
 public void Abs()
 {
     _t.Test(
         @"Num.abs(-42);",
         @"42",
         typeof(DekiScriptNumber)
         );
 }
예제 #8
0
 public void AddDays()
 {
     _t.Test(
         @"Date.adddays(""01/01/2000"", 10);",
         @"Tue, 11 Jan 2000 00:00:00 GMT",
         typeof(DekiScriptString)
         );
 }
 public void AppendPath_String()
 {
     _t.Test(
         @"uri.appendpath(""http://www.mindtouch.com"", ""download"")",
         @"http://www.mindtouch.com/download",
         typeof(DekiScriptString)
         );
 }
예제 #10
0
 public void Cast()
 {
     _t.Test(
         @"String.cast(42);",
         @"42",
         typeof(DekiScriptString)
         );
 }