Skip to content

Commit 011f15b

Browse files
committed
Fixes #71
1 parent 82338d2 commit 011f15b

26 files changed

Lines changed: 612 additions & 761 deletions
Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,21 @@
11
Partial Public Class VBCompilerGeneratedBase
2-
Private Class DummyWithDefault
3-
Dim data As Integer
4-
Default Property Item(index As Integer) As Integer
5-
Get
6-
Return data
7-
End Get
8-
Set(value As Integer)
9-
data = index
10-
End Set
11-
End Property
12-
End Class
13-
142
<Fact> <Trait("Category", Indexer)>
153
Public Sub ArraySingleIndex()
16-
Dim arr = New String() {}
17-
RunTest(
18-
Function() arr(5),
19-
"() => arr[5]",
20-
"Function() arr(5)",
21-
"Lambda(
22-
ArrayIndex(arr,
23-
Constant(5)
24-
)
25-
)"
26-
)
4+
PreRunTest()
275
End Sub
286

297
<Fact> <Trait("Category", Indexer)>
308
Public Sub ArrayMultipleIndex()
31-
Dim arr = New String(,) {}
32-
RunTest(
33-
Function() arr(5, 6),
34-
"() => arr[5, 6]",
35-
"Function() arr(5, 6)",
36-
"Lambda(
37-
ArrayIndex(arr,
38-
Constant(5),
39-
Constant(6)
40-
)
41-
)"
42-
)
9+
PreRunTest()
4310
End Sub
4411

4512
<Fact> <Trait("Category", Indexer)>
4613
Public Sub TypeIndexer()
47-
Dim lst = New List(Of String)()
48-
RunTest(
49-
Function() lst(3),
50-
"() => lst[3]",
51-
"Function() lst(3)",
52-
"Lambda(
53-
Property(lst,
54-
typeof(List<string>).GetProperty(""Item""),
55-
Constant(3)
56-
)
57-
)"
58-
)
14+
PreRunTest()
5915
End Sub
6016

6117
<Fact> <Trait("Category", Indexer)>
6218
Public Sub VBDeclaredTypeIndexer()
63-
Dim x As New DummyWithDefault
64-
RunTest(
65-
Function() x(5),
66-
"() => x[5]",
67-
"Function() x(5)",
68-
"Lambda(
69-
Property(x,
70-
typeof(DummyWithDefault).GetProperty(""Item""),
71-
Constant(5)
72-
)
73-
)"
74-
)
19+
PreRunTest()
7520
End Sub
7621
End Class
Lines changed: 6 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,31 @@
11
Partial Public Class VBCompilerGeneratedBase
22
<Fact> <Trait("Category", Lambdas)>
33
Sub NoParametersVoidReturn()
4-
RunTest(
5-
Sub() Console.WriteLine(),
6-
"() => Console.WriteLine()",
7-
"Sub() Console.WriteLine",
8-
"Lambda(
9-
Call(
10-
typeof(Console).GetMethod(""WriteLine"")
11-
)
12-
)"
13-
)
4+
PreRunTest()
145
End Sub
156

167
<Fact> <Trait("Category", Lambdas)>
178
Sub OneParameterVoidReturn()
18-
RunTest(Of String)(
19-
Sub(s) Console.WriteLine(s),
20-
"(string s) => Console.WriteLine(s)",
21-
"Sub(s As String) Console.WriteLine(s)",
22-
"Lambda(
23-
Call(
24-
typeof(Console).GetMethod(""WriteLine""),
25-
s
26-
),
27-
var s = Parameter(
28-
typeof(string),
29-
""s""
30-
)
31-
)"
32-
)
9+
PreRunTest()
3310
End Sub
3411

3512
<Fact> <Trait("Category", Lambdas)>
3613
Sub TwoParametersVoidReturn()
37-
RunTest(Of String, String)(
38-
Sub(s1, s2) Console.WriteLine(s1 + s2),
39-
"(string s1, string s2) => Console.WriteLine(s1 + s2)",
40-
"Sub(s1 As String, s2 As String) Console.WriteLine(s1 + s2)",
41-
"Lambda(
42-
Call(
43-
typeof(Console).GetMethod(""WriteLine""),
44-
Call(
45-
typeof(string).GetMethod(""Concat""),
46-
s1, s2
47-
)
48-
),
49-
var s1 = Parameter(
50-
typeof(string),
51-
""s1""
52-
),
53-
var s2 = Parameter(
54-
typeof(string),
55-
""s2""
56-
)
57-
)"
58-
)
14+
PreRunTest()
5915
End Sub
6016

6117
<Fact> <Trait("Category", Lambdas)>
6218
Sub NoParametersNonVoidReturn()
63-
RunTest(
64-
Function() "abcd",
65-
"() => ""abcd""",
66-
"Function() ""abcd""",
67-
"Lambda(
68-
Constant(""abcd"")
69-
)"
70-
)
19+
PreRunTest()
7120
End Sub
7221

7322
<Fact> <Trait("Category", Lambdas)>
7423
Sub OneParameterNonVoidReturn()
75-
RunTest(Of String, String)(
76-
Function(s) s,
77-
"(string s) => s",
78-
"Function(s As String) s",
79-
"Lambda(s,
80-
var s = Parameter(
81-
typeof(string),
82-
""s""
83-
)
84-
)"
85-
)
24+
PreRunTest()
8625
End Sub
8726

8827
<Fact> <Trait("Category", Lambdas)>
8928
Sub TwoParametersNonVoidReturn()
90-
RunTest(Of String, String, String)(
91-
Function(s1, s2) s1 + s2,
92-
"(string s1, string s2) => s1 + s2",
93-
"Function(s1 As String, s2 As String) s1 + s2",
94-
"Lambda(
95-
Call(
96-
typeof(string).GetMethod(""Concat""),
97-
s1, s2
98-
),
99-
var s1 = Parameter(
100-
typeof(string),
101-
""s1""
102-
),
103-
var s2 = Parameter(
104-
typeof(string),
105-
""s2""
106-
)
107-
)"
108-
)
29+
PreRunTest()
10930
End Sub
11031
End Class

Tests.Common.VB/CompilerGenerated/Literals.vb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,7 @@ Partial Public Class VBCompilerGeneratedBase
5050

5151
<Fact> <Trait("Category", Literal)>
5252
Sub EscapedString()
53-
RunTest(
54-
Function() """",
55-
"() => ""\""""",
56-
"Function() """"""""",
57-
"Lambda(
58-
Constant(""\"""")
59-
)"
60-
)
53+
PreRunTest()
6154
End Sub
6255

6356
<Fact> <Trait("Category", Literal)>

Tests.Common.VB/CompilerGenerated/Member.vb

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,17 @@
11
Partial Public Class VBCompilerGeneratedBase
22
<Fact> <Trait("Category", Member)>
33
Sub InstanceMember()
4-
Dim s = ""
5-
RunTest(
6-
Function() s.Length,
7-
"() => s.Length",
8-
"Function() s.Length",
9-
"Lambda(
10-
MakeMemberAccess(s,
11-
typeof(string).GetProperty(""Length"")
12-
)
13-
)"
14-
)
4+
PreRunTest()
155
End Sub
166

177
<Fact> <Trait("Category", Member)>
188
Sub ClosedVariable()
19-
Dim s = ""
20-
RunTest(
21-
Function() s,
22-
"() => s",
23-
"Function() s",
24-
"Lambda(s)"
25-
)
9+
PreRunTest()
2610
End Sub
2711

2812
<Fact> <Trait("Category", Member)>
2913
Sub StaticMember()
30-
RunTest(
31-
Function() String.Empty,
32-
"() => string.Empty",
33-
"Function() String.Empty",
34-
"Lambda(
35-
MakeMemberAccess(null,
36-
typeof(string).GetField(""Empty"")
37-
)
38-
)"
39-
)
14+
PreRunTest()
4015
End Sub
4116

4217
<Fact(Skip:="Test for nested scope")> <Trait("Category", Member)>

0 commit comments

Comments
 (0)