Ejemplo n.º 1
0
        public void BugFix_VBScriptItemArgsByRef_VB_Enum()
        {
            TestUtil.InvokeVBTestSub(@"
                Using engine As New VBScriptEngine

                    Dim a = DayOfWeek.Monday
                    Dim b = DayOfWeek.Tuesday
                    Dim c = DayOfWeek.Wednesday
                    Dim x = DayOfWeek.Sunday
                    Dim y = DayOfWeek.Saturday
                    Dim z = DayOfWeek.Friday

                    engine.Script.a = a
                    engine.Script.b = b
                    engine.Script.c = c
                    engine.Script.x = x
                    engine.Script.y = y
                    engine.Script.z = z

                    engine.Execute(""sub test(i, j, k) : i = x : j = y : k = z : end sub"")
                    engine.Script.test(a, b, c)

                    Assert.AreEqual(x, a)
                    Assert.AreEqual(y, b)
                    Assert.AreEqual(z, c)

                End Using
            ");
        }
Ejemplo n.º 2
0
        public void BugFix_VBScriptItemArgsByRef_VB_Struct()
        {
            TestUtil.InvokeVBTestSub(@"
                Using engine As New VBScriptEngine

                    Dim random = New Random
                    Dim a = TimeSpan.FromMilliseconds(random.NextDouble() * 1000)
                    Dim b = TimeSpan.FromMilliseconds(random.NextDouble() * 1000)
                    Dim c = TimeSpan.FromMilliseconds(random.NextDouble() * 1000)
                    Dim x = TimeSpan.FromMilliseconds(random.NextDouble() * 1000)
                    Dim y = TimeSpan.FromMilliseconds(random.NextDouble() * 1000)
                    Dim z = TimeSpan.FromMilliseconds(random.NextDouble() * 1000)

                    engine.Script.a = a
                    engine.Script.b = b
                    engine.Script.c = c
                    engine.Script.x = x
                    engine.Script.y = y
                    engine.Script.z = z

                    engine.Execute(""sub test(i, j, k) : i = x : j = y : k = z : end sub"")
                    engine.Script.test(a, b, c)

                    Assert.AreEqual(x, a)
                    Assert.AreEqual(y, b)
                    Assert.AreEqual(z, c)

                End Using
            ");
        }
Ejemplo n.º 3
0
        public void BugFix_VBScriptItemArgsByRef_VB_Scalar()
        {
            TestUtil.InvokeVBTestSub(@"
                Using engine As New VBScriptEngine

                    Dim a = 123
                    Dim b = 456
                    Dim c = 789
                    Dim x = 987
                    Dim y = 654
                    Dim z = 321

                    engine.Script.a = a
                    engine.Script.b = b
                    engine.Script.c = c
                    engine.Script.x = x
                    engine.Script.y = y
                    engine.Script.z = z

                    engine.Execute(""sub test(i, j, k) : i = x : j = y : k = z : end sub"")
                    engine.Script.test(a, b, c)

                    Assert.AreEqual(x, a)
                    Assert.AreEqual(y, b)
                    Assert.AreEqual(z, c)

                End Using
            ");
        }
Ejemplo n.º 4
0
        public void BugFix_VBScriptItemArgsByRef_VB()
        {
            TestUtil.InvokeVBTestSub(@"
                Using engine As New VBScriptEngine

                    Dim a = New Object
                    Dim b = New Object
                    Dim c = New Object
                    Dim x = New Object
                    Dim y = New Object
                    Dim z = New Object

                    engine.Script.a = a
                    engine.Script.b = b
                    engine.Script.c = c
                    engine.Script.x = x
                    engine.Script.y = y
                    engine.Script.z = z

                    engine.Execute(""sub test(i, j, k) : i = x : j = y : k = z : end sub"")
                    engine.Script.test(a, b, c)

                    Assert.AreSame(x, a)
                    Assert.AreSame(y, b)
                    Assert.AreSame(z, c)

                End Using
            ");
        }
Ejemplo n.º 5
0
 public void BugFix_VBCallToParameterlessVBScriptSub()
 {
     TestUtil.InvokeVBTestSub(@"
         Using engine As New VBScriptEngine
             engine.Execute(""sub main : end sub"")
             engine.Script.main()
         End Using
     ");
 }
Ejemplo n.º 6
0
 public void BugFix_NestedType_VBScript_VB()
 {
     TestUtil.InvokeVBTestSub(@"
         Using engine As New VBScriptEngine
             engine.AddHostType(GetType(BugFixTest.NestedTypeTest))
             Assert.AreEqual(BugFixTest.NestedTypeTest.NestedType.Foo, engine.Evaluate(""NestedTypeTest.NestedType.Foo""))
             Assert.AreEqual(BugFixTest.NestedTypeTest.NestedType.Bar, engine.Evaluate(""NestedTypeTest.NestedType.Bar""))
             Assert.AreEqual(BugFixTest.NestedTypeTest.NestedType.Baz, engine.Evaluate(""NestedTypeTest.NestedType.Baz""))
             Assert.AreEqual(BugFixTest.NestedTypeTest.NestedType.Qux, engine.Evaluate(""NestedTypeTest.NestedType.Qux""))
         End Using
     ");
 }
Ejemplo n.º 7
0
 public void BugFix_NonEnumerablePropertyAccess_JScript_VB()
 {
     TestUtil.InvokeVBTestSub(@"
         Using engine As New JScriptEngine
             engine.Script.dump = Sub(obj As Object, value As String)
                 Assert.AreEqual(value, obj.message)
             End Sub
             engine.Execute(
                 ""message = 'hello';"" & _
                 ""dump({ message: message }, message);"" & _
                 ""message = 'world';"" & _
                 ""dump(new Error(message), message);""
             )
         End Using
     ");
 }
Ejemplo n.º 8
0
 public void BugFix_NonexistentPropertyAccess_JScript_VB()
 {
     TestUtil.InvokeVBTestSub(@"
         Using engine As New JScriptEngine
             engine.Script.dump = Sub(obj As Object, message As Object, stack As Object)
                 Assert.AreEqual(message, obj.message)
                 Assert.AreEqual(stack, obj.stack)
             End Sub
             engine.Execute(
                 ""message = 'hello';"" & _
                 ""stack = 'world';"" & _
                 ""dump({ message: message, stack: stack }, message, stack);"" & _
                 ""dump({ message: message }, message, undefined);""
             )
         End Using
     ");
 }