Author: sudha
Date: 2005-04-29 00:38:28 -0400 (Fri, 29 Apr 2005)
New Revision: 43766
Added:
trunk/mcs/mbas/Test/errors/LateBindingC2.vb
trunk/mcs/mbas/Test/rerrors/Test/LateBinding13.vb
trunk/mcs/mbas/Test/rerrors/Test/LateBinding14.vb
trunk/mcs/mbas/Test/tests/latebinding/ArrayC.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropC.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropD.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropE.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropF.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropG.vb
trunk/mcs/mbas/Test/tests/latebinding/DefaultPropH.vb
trunk/mcs/mbas/Test/tests/latebinding/MethodDeclarationA.vb
trunk/mcs/mbas/Test/tests/latebinding/OptionalArgFunctionA.vb
trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceA.vb
trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceB.vb
trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncA.vb
trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncB.vb
trunk/mcs/mbas/Test/tests/latebinding/OptionalArgumentA.vb
trunk/mcs/mbas/Test/tests/latebinding/OverloadingA.vb
trunk/mcs/mbas/Test/tests/latebinding/OverrideA.vb
trunk/mcs/mbas/Test/tests/latebinding/OverrideB.vb
trunk/mcs/mbas/Test/tests/latebinding/OverrideC.vb
trunk/mcs/mbas/Test/tests/latebinding/OverrideD.vb
trunk/mcs/mbas/Test/tests/latebinding/OverrideE.vb
trunk/mcs/mbas/Test/tests/latebinding/PropertyB.vb
trunk/mcs/mbas/Test/tests/latebinding/TypeMembersR.vb
trunk/mcs/mbas/Test/tests/latebinding/TypeMembersS.vb
trunk/mcs/mbas/Test/tests/latebinding/TypeMembersT.vb
trunk/mcs/mbas/Test/tests/latebinding/VariablesA.vb
trunk/mcs/mbas/Test/tests/latebinding/VariablesB.vb
trunk/mcs/mbas/Test/tests/latebinding/VariablesC.vb
trunk/mcs/mbas/Test/tests/latebinding/VariablesD.vb
trunk/mcs/mbas/Test/tests/latebinding/WithStatementA.vb
Modified:
trunk/mcs/mbas/Test/ChangeLog
trunk/mcs/mbas/Test/tests/types/ArrayH.vb
Log:
More testcases for late binding - by Sudharsan V
Modified: trunk/mcs/mbas/Test/ChangeLog
===================================================================
--- trunk/mcs/mbas/Test/ChangeLog 2005-04-29 04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/ChangeLog 2005-04-29 04:38:28 UTC (rev 43766)
@@ -1,6 +1,11 @@
-2005-03-30 Satya Sudha K <[EMAIL PROTECTED]>
+2005-04-29 Satya Sudha K <[EMAIL PROTECTED]>
Sudharsan V <[EMAIL PROTECTED]>
+ * More testcases for Late binding
+
+2005-04-26 Satya Sudha K <[EMAIL PROTECTED]>
+ Sudharsan V <[EMAIL PROTECTED]>
+
* Testcases for Late binding
* Few negative testcases for typemembers
Added: trunk/mcs/mbas/Test/errors/LateBindingC2.vb
===================================================================
--- trunk/mcs/mbas/Test/errors/LateBindingC2.vb 2005-04-29 04:07:24 UTC (rev
43765)
+++ trunk/mcs/mbas/Test/errors/LateBindingC2.vb 2005-04-29 04:38:28 UTC (rev
43766)
@@ -0,0 +1,31 @@
+REM LineNo: 21
+REM ExpectedError: BC30591
+REM ErrorMessage: 'WithEvents' variable does not raise any events.
+
+Imports System
+
+Class C
+ Public Event E
+
+ Public Sub S()
+ RaiseEvent E
+ End Sub
+End Class
+
+Class C1
+ dim WithEvents x as Object = new C()
+ Sub call_S()
+ x.S()
+ End Sub
+
+ Sub EH() Handles x.E
+ Console.WriteLine("event called")
+ End Sub
+End Class
+
+Module M
+ Sub Main()
+ dim y as new C1
+ y.call_S()
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/rerrors/Test/LateBinding13.vb
===================================================================
--- trunk/mcs/mbas/Test/rerrors/Test/LateBinding13.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/rerrors/Test/LateBinding13.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,15 @@
+Imports System
+Imports Nunit.Framework
+
+Class TestConstant
+ public const c as integer = 10
+End Class
+
+<TestFixture>_
+Public Class Constant1
+ _<Test, ExpectedException (GetType (System.FieldAccessException))>
+ Public Sub TestForException()
+ Dim o as Object = new TestConstant()
+ o.c = 20
+ End Sub
+End Class
Added: trunk/mcs/mbas/Test/rerrors/Test/LateBinding14.vb
===================================================================
--- trunk/mcs/mbas/Test/rerrors/Test/LateBinding14.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/rerrors/Test/LateBinding14.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,36 @@
+Imports System
+Imports Nunit.Framework
+
+Class TestWith
+ Public a1 As Integer = 10
+ Friend a2 As String = "Hello"
+ Sub f1()
+ Console.WriteLine("Class C1: {0} {1}", a1, a2)
+ End Sub
+End Class
+
+<TestFixture>_
+Public Class WithStatement123
+ _<Test, ExpectedException (GetType (System.FieldAccessException))>
+ Public Sub TestForException()
+ Dim a As Object = New TestWith()
+ With a
+ .a1 = 20
+ .a2 = "Hello World"
+ .f1()
+ Dim x As New TestWith()
+ x.a1 = 2
+ With x
+ .a1 = 3
+ .a2 = "In nested With statement"
+ .f1()
+ a.a1 = 25
+ a.a2 = "Me too"
+ a.f1()
+ End With
+ End With
+
+ With a ' Empty With statement
+ End With
+ End Sub
+End Class
Added: trunk/mcs/mbas/Test/tests/latebinding/ArrayC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/ArrayC.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/ArrayC.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,21 @@
+Imports System
+Imports Microsoft.VisualBasic
+
+Class C
+ Public a() As Integer = {1, 2, 3, 4, 5}
+End Class
+
+Module VariableC
+ Sub Main()
+ dim c as Integer
+ dim o as Object = new C()
+ c = UBound(o.a, 1)
+ if c<>4
+ Throw New System.Exception("#A1 Error")
+ End If
+ c = LBound(o.a, 1)
+ if c<>0
+ Throw New System.Exception("#A2 Error")
+ End if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropC.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropC.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,29 @@
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Shadows Default ReadOnly Property Item(ByVal i as Integer)As
Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropD.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropD.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropD.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,47 @@
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Shadows ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Class derive1
+ Inherits derive
+ Public Shadows Default ReadOnly Property Item1(ByVal i as Integer)As
Integer
+ Get
+ Return 3*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive1()
+ Dim b as derive = a
+ Dim i, j, k as Integer
+ i=a(10)
+ j=a.Item(10)
+ k=b(10)
+ if i<>30 Then
+ Throw New Exception("#A1 Default Not Working properly
in Derive1")
+ End If
+ if j<>20 Then
+ Throw New Exception("#A2 Default Not Working properly
in Derive")
+ End If
+ if k<>10 Then
+ Throw New Exception("#A3 Default Not Working properly
in Base ")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropE.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropE.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropE.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,38 @@
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+ Public Default ReadOnly Property Item(ByVal i as Integer,ByVal j as
Integer)As Integer
+ Get
+ Return i+j
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overloads Default ReadOnly Property Item(ByVal i as Integer)As
Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i,j as Integer
+ i=a(10)
+ j=a(10,20)
+ if i<>20 Then
+ Throw New Exception("#A1 Default Not Working")
+ End If
+ if j<>30 Then
+ Throw New Exception("#A2 Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropF.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropF.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropF.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,29 @@
+Imports System
+
+Class base
+ Public Default ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overloads Default ReadOnly Property Item(ByVal i as Integer)As
Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object =new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropG.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropG.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropG.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,25 @@
+Imports System
+
+Interface base
+ Default ReadOnly Property Item(ByVal i as Integer)As Integer
+End Interface
+
+Class derive
+ Implements base
+ Public Overloads ReadOnly Default Property Item(ByVal i as Integer)As
Integer Implements base.Item
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/DefaultPropH.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/DefaultPropH.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/DefaultPropH.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,25 @@
+Imports System
+
+Class base
+ Dim ia as integer
+ Public Default Property Item(ByVal i as Integer)As Integer
+ Get
+ Return ia
+ End Get
+ Set(ByVal j as Integer)
+ ia=j
+ End Set
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new base()
+ Dim i as Integer
+ a(1)=4
+ i=a(10)
+ if i<>4 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/MethodDeclarationA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/MethodDeclarationA.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/MethodDeclarationA.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,21 @@
+'Author:
+' V. Sudharsan ([EMAIL PROTECTED])
+'
+' (C) 2005 Novell, Inc.
+
+Imports System
+
+Module MethodDeclarationA
+Class C
+ Function A(i as Integer)As Integer
+ End Function
+ Function AB()As Integer
+ return 10
+ End Function
+End Class
+ Sub Main()
+ Dim o As Object = new C()
+ o.A (o.AB())
+ End Sub
+End Module
+
Added: trunk/mcs/mbas/Test/tests/latebinding/OptionalArgFunctionA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OptionalArgFunctionA.vb
2005-04-29 04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OptionalArgFunctionA.vb
2005-04-29 04:38:28 UTC (rev 43766)
@@ -0,0 +1,24 @@
+Imports System
+Class C
+ Function F(ByVal telephoneNo as Long, Optional ByVal code as Integer =
080,Optional ByVal code1 As Integer = 091, Optional ByRef name As
String="Sinha") As Boolean
+ if (code = 080 and code1 = 091 and name="Manish")
+ return true
+ else
+ return false
+ end if
+ End Function
+End Class
+
+Module OP1_0_0
+ Sub Main()
+ Dim o as Object = new C()
+ Dim telephoneNo As Long = 9886066432
+ Dim name As String ="Manish"
+ Dim status As Boolean
+ status =o.F(telephoneNo,,,name)
+ if (status = false)
+ Throw New System.Exception("#A1, Unexcepted behaviour in string
of OP1_0_0")
+ end if
+ End Sub
+
+End Module
\ No newline at end of file
Added: trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceA.vb
2005-04-29 04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceA.vb
2005-04-29 04:38:28 UTC (rev 43766)
@@ -0,0 +1,18 @@
+Imports System
+Class c
+ Sub F(ByVal telephoneNo as Long, Optional ByRef code as Integer = 080)
+ if (code = 080)
+ Throw New System.Exception("#A1, Unexcepted behaviour
in string of OP1_0_1")
+ end if
+ End Sub
+End Class
+
+Module OP1_0_1
+ Sub Main()
+ Dim o as Object = new c()
+ Dim telephoneNo As Long = 9886066432
+ Dim code As Integer = 081
+ o.F(telephoneNo,code)
+ End Sub
+
+End Module
\ No newline at end of file
Added: trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceB.vb
2005-04-29 04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByReferenceB.vb
2005-04-29 04:38:28 UTC (rev 43766)
@@ -0,0 +1,16 @@
+Imports System
+Class C
+ Sub F(ByVal telephoneNo as Long, Optional ByRef code as Integer = 080)
+ if (code <> 080)
+ Throw New System.Exception("#A1, Unexcepted behaviour
in string of OP1_0_0")
+ end if
+ End Sub
+End Class
+
+Module OP1_0_0
+ Sub Main()
+ Dim o as object = new C()
+ Dim telephoneNo As Long = 9886066432
+ o.F(telephoneNo)
+ End Sub
+End Module
\ No newline at end of file
Added: trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncA.vb
2005-04-29 04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncA.vb
2005-04-29 04:38:28 UTC (rev 43766)
@@ -0,0 +1,23 @@
+Imports System
+Class C
+ Function F(ByVal telephoneNo as Long, Optional ByVal code as Integer =
080) As Boolean
+ if (code <> 080)
+ return false
+ else
+ return true
+ end if
+ End Function
+End Class
+
+Module OP1_0_0
+ Sub Main()
+ Dim o as object = new C()
+ Dim telephoneNo As Long = 9886066432
+ Dim status as Boolean
+ status = o.F(telephoneNo)
+ if(status = false)
+ Throw New System.Exception("#A1, Unexcepted behaviour in string
of OP1_0_1")
+ end if
+ End Sub
+
+End Module
\ No newline at end of file
Added: trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncB.vb
2005-04-29 04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OptionalArgu_ByValFuncB.vb
2005-04-29 04:38:28 UTC (rev 43766)
@@ -0,0 +1,24 @@
+Imports System
+Class C
+ Function F(ByVal telephoneNo as Long, Optional ByVal code as Integer =
080) As Boolean
+ if (code = 080)
+ return false
+ else
+ return true
+ end if
+ End Function
+End CLass
+
+Module OP1_0_1
+ Sub Main()
+ Dim o as Object = new C()
+ Dim telephoneNo As Long = 9886066432
+ Dim code As Integer = 081
+ Dim status as Boolean
+ status = o.F(telephoneNo,code)
+ if(status = false)
+ Throw New System.Exception("#A1, Unexcepted behaviour in string
of OP1_0_1")
+ end if
+ End Sub
+
+End Module
\ No newline at end of file
Added: trunk/mcs/mbas/Test/tests/latebinding/OptionalArgumentA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OptionalArgumentA.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OptionalArgumentA.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,17 @@
+Imports System
+Class C
+ Sub F(ByVal telephoneNo as Long, Optional ByVal code as Integer =
080,Optional ByVal code1 As Integer = 091, Optional ByRef name As
String="Sinha")
+ if (code <> 080 and code1 <> 091 and name="Sinha")
+ Throw New System.Exception("#A1, Unexcepted behaviour
in string of OP1_0_0")
+ end if
+ End Sub
+End Class
+Module OP1_0_0
+ Sub Main()
+ dim o as Object = new C()
+ Dim telephoneNo As Long = 9886066432
+ Dim name As String ="Manish"
+ o.F(telephoneNo,,,name)
+ End Sub
+
+End Module
\ No newline at end of file
Added: trunk/mcs/mbas/Test/tests/latebinding/OverloadingA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OverloadingA.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OverloadingA.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,36 @@
+'Testing overloading in different classes
+Class B
+ Function F()
+ End Function
+
+ Function F(ByVal i As Integer)
+ End Function
+
+ Function F1()
+ End Function
+
+ Function F1(ByVal i As Integer)
+ End Function
+End Class
+
+Class D
+ Inherits B
+
+ Overloads Function F()
+ End Function
+End Class
+
+Module OverloadingA
+ Sub Main()
+ Dim x As Object = New D()
+
+ x.F()
+ x.F(10)
+ x.F1(20)
+
+ Dim x1 As Object = New B()
+ x1.F(20)
+ x1.F1()
+ End Sub
+
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/OverrideA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OverrideA.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OverrideA.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,26 @@
+Imports System
+
+Class C1
+ Overridable Function fun(j as Integer)
+ End Function
+End Class
+
+Class C2
+ Inherits C1
+ Overrides Function fun(j as Integer)
+ i=j
+ return i
+ End Function
+ Public i as Integer
+End Class
+
+Module InheritanceM
+ Sub Main()
+ Dim a as Object = new C2()
+ Try
+ a.fun(a.i)
+ Catch e as Exception
+ Throw new System.Exception(e.Message)
+ End Try
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/OverrideB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OverrideB.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OverrideB.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,34 @@
+Class B
+ Overridable Function F() As Integer
+ Return 5
+ End Function
+End Class
+
+Class D
+ Inherits B
+
+ Overrides Function F() As Integer
+ ' you should be able to access
+ ' the members of base class
+ ' using 'MyBase' as follows
+ MyBase.F()
+
+ Return 10
+ End Function
+End Class
+
+Module OverrideA
+ Sub Main()
+ Dim x As Object
+
+ x = New B()
+ If x.F() <> 5 Then
+ Throw New System.Exception("#A1, unexpected result from base
class")
+ End If
+
+ x = New D()
+ If x.F() <> 10 Then
+ Throw New System.Exception("#A2, unexpected result from derived
class")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/OverrideC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OverrideC.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OverrideC.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,31 @@
+'Checks if Default is working or not with Overrides...It works
+
+Imports System
+
+Class base
+ Public Default Overridable ReadOnly Property Item(ByVal i as Integer)As
Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Default Overrides ReadOnly Property Item(ByVal i as Integer)As
Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i as Integer
+ i=a(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/OverrideD.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OverrideD.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OverrideD.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,29 @@
+Imports System
+
+Class base
+ Public Overridable ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overrides ReadOnly Property Item(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i as Integer
+ i=a.Item(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/OverrideE.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/OverrideE.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/OverrideE.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,33 @@
+Imports System
+
+Class base
+ Public Overridable Property Item(ByVal i as Integer)As Integer
+ Get
+ Return i
+ End Get
+ Set
+ End Set
+ End Property
+End Class
+
+Class derive
+ Inherits base
+ Public Overrides Property Item(ByVal i as Integer)As Integer
+ Get
+ Return 2*i
+ End Get
+ Set
+ End Set
+ End Property
+End Class
+
+Module DefaultA
+ Sub Main()
+ Dim a as Object=new derive()
+ Dim i as Integer
+ i=a.Item(10)
+ if i<>20 Then
+ Throw New Exception("Default Not Working")
+ End If
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/PropertyB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/PropertyB.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/PropertyB.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,24 @@
+Imports System
+
+Class C
+ private i as integer
+ public Property p() as Integer
+ GET
+ return i
+ END GET
+
+ SET (ByVal val as Integer)
+ i = val
+ End SET
+ End Property
+End Class
+
+Module M
+ Sub Main()
+ dim o as Object = new C()
+ o.p = 10
+ if o.p<> 10 then
+ throw new System.Exception("#A1 Latebinding not
working")
+ End if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/TypeMembersR.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/TypeMembersR.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/TypeMembersR.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,20 @@
+'Author:
+' V. Sudharsan ([EMAIL PROTECTED])
+'
+' (C) 2005 Novell, Inc.
+
+Imports System
+
+Class C
+ Public a as Integer() = {1,2,3}
+End Class
+
+Module M
+ Sub Main()
+ dim o as object = new C()
+ o.a(1) = 0
+ if o.a(1) then
+ throw new System.Exception("LateBinding Not Working")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/TypeMembersS.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/TypeMembersS.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/TypeMembersS.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,27 @@
+'Author:
+' V. Sudharsan ([EMAIL PROTECTED])
+'
+' (C) 2005 Novell, Inc.
+
+Imports System
+
+Class C
+ Public a as Integer() = {1,2,3}
+End Class
+
+Class B
+ Function fun(ByRef i() as Integer, j as integer)
+ i(j) = 0
+ End Function
+End Class
+
+Module M
+ Sub Main()
+ dim o as object = new C()
+ dim o1 as object = new B()
+ o1.fun(o.a, 1)
+ if o.a(1) then
+ throw new System.Exception("LateBinding Not Working")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/TypeMembersT.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/TypeMembersT.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/TypeMembersT.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,27 @@
+'Author:
+' V. Sudharsan ([EMAIL PROTECTED])
+'
+' (C) 2005 Novell, Inc.
+
+Imports System
+
+Class C
+ Public a as Integer() = {1,2,3}
+End Class
+
+Class B
+ Function fun(i() as Integer, j as integer)
+ i(j) = 0
+ End Function
+End Class
+
+Module M
+ Sub Main()
+ dim o as object = new C()
+ dim o1 as object = new B()
+ o1.fun(o.a, 1)
+ if o.a(1)<>2 then
+ throw new System.Exception("LateBinding Not Working ")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/VariablesA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/VariablesA.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/VariablesA.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,59 @@
+Imports System
+Class A
+ public shared y as integer = 20
+ public z as integer = 30
+
+ Shared Sub New()
+ End Sub
+
+ public Sub New()
+ End Sub
+
+ Shared function f() as integer
+ return 50
+ end function
+end class
+
+Module M
+ Sub Main()
+ if (A.y <> 20) then
+ Throw new Exception ("#A1, Unexpected result")
+ end if
+
+ dim c as object = new A()
+ dim d as object = new A()
+
+ if(c.y <> 20) then
+ Throw new Exception ("#A2, Unexpected result")
+ end if
+
+ if(d.y <> 20) then
+ Throw new Exception ("#A3, Unexpected result")
+ end if
+
+ A.y = 25
+
+ if(c.y <> 25) then
+ Throw new Exception ("#A4, Unexpected result")
+ end if
+
+ c.y = 35
+
+ if(A.y <> 35) then
+ Throw new Exception ("#A5, Unexpected result")
+ end if
+
+ if(d.y <> 35) then
+ Throw new Exception ("#A6, Unexpected result")
+ end if
+
+
+ if(c.z <> 30) then
+ Throw new Exception ("#A7, Unexpected result")
+ end if
+
+ if(A.f() <> 50) then
+ Throw new Exception ("#A8, Unexpected result")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/VariablesB.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/VariablesB.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/VariablesB.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,17 @@
+Class AA
+ Shared public i as Integer
+End Class
+
+Module M
+ Sub Main()
+ dim o as Object = new AA()
+ o.i = o.i+1
+ fun()
+ End Sub
+ Sub fun()
+ AA.i = AA.i+1
+ if AA.i<>2
+ Throw new System.Exception("Shared variable not
workin")
+ end if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/VariablesC.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/VariablesC.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/VariablesC.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,21 @@
+Imports System
+
+Class A
+ Public i as Integer
+ Sub New()
+ i = 20
+ End Sub
+ Sub New (a as A)
+ i = a.i
+ End Sub
+End Class
+
+Module Test
+ Public Sub Main()
+ dim a as Object = new A()
+ dim j as Object = new A(a)
+ if j.i<>20
+ Throw new System.Exception("Initializer not working")
+ End if
+ End Sub
+End Module
Added: trunk/mcs/mbas/Test/tests/latebinding/VariablesD.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/VariablesD.vb 2005-04-29 04:07:24 UTC
(rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/VariablesD.vb 2005-04-29 04:38:28 UTC
(rev 43766)
@@ -0,0 +1,22 @@
+Imports System
+
+Class AA
+ Inherits System.MarshalByRefObject
+ Public Function fun()
+ End Function
+End Class
+
+
+Class AAA
+ Public Function fun(a As AA)
+ End Function
+End Class
+
+Module Test
+ Public Sub Main()
+ dim b as Object = new AA()
+ dim a as Object = new AAA()
+ a.fun(b)
+ End Sub
+End Module
+
Added: trunk/mcs/mbas/Test/tests/latebinding/WithStatementA.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/latebinding/WithStatementA.vb 2005-04-29
04:07:24 UTC (rev 43765)
+++ trunk/mcs/mbas/Test/tests/latebinding/WithStatementA.vb 2005-04-29
04:38:28 UTC (rev 43766)
@@ -0,0 +1,33 @@
+Imports System
+
+Module WithStatementC
+ Class C1
+ Public a1 As Integer = 10
+ Public a2 As String = "Hello"
+ Sub f1()
+ Console.WriteLine("Class C1: {0} {1}", a1, a2)
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim a As Object = New C1()
+ With a
+ .a2 = "Hello World"
+ GoTo labelA
+ ' Exit before all statements in With have been executed
+ .a1 = 20
+ Dim x As New C1()
+ a = x
+ If .a1 = a.a1 Or .a2 = a.a2 Then
+ Throw New Exception("#WS1 - With Statement failed")
+ End If
+ a.f1()
+ .f1()
+labelA:
+ End With
+ If a.a1 = 20 Then
+ Throw New Exception("#WS2- Exit from With Statement failed")
+ End If
+ End Sub
+
+End Module
\ No newline at end of file
Modified: trunk/mcs/mbas/Test/tests/types/ArrayH.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/types/ArrayH.vb 2005-04-29 04:07:24 UTC (rev
43765)
+++ trunk/mcs/mbas/Test/tests/types/ArrayH.vb 2005-04-29 04:38:28 UTC (rev
43766)
@@ -23,6 +23,7 @@
if a4(1) <> False then
Throw New System.Exception("Boolean array not working")
End if
+ System.Console.WriteLine (a5(1) = nothing)
if a5(1) <> "" then
Throw New System.Exception("String array not working")
End if
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches