| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package VSGDR::UnitTest::TestSet::Representation::NET::VB; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1987
|
use 5.010; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#our \$VERSION = '1.04'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
7
|
use parent qw(VSGDR::UnitTest::TestSet::Representation::NET) ; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
11
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#TODO 1. Add support for test method attributes eg new vs2010 exceptions ala : -[ExpectedSqlException(MessageNumber = nnnnn, Severity = x, MatchFirstError = false, State = y)] |
|
14
|
|
|
|
|
|
|
#TODO 2. Add checking support in the parser, etc that the bits of code we don't care about match our expectations. Otherwise we risk screwing non-standard test classes |
|
15
|
|
|
|
|
|
|
#TODO 3: If a condition has the same name as a test ( ie like the prefix of a test action, the check to determine resource or test condition fails. We've strengthened it, but it might not ultimately be fixable. |
|
16
|
|
|
|
|
|
|
#TODO 4: Noticed that VS2010 generated tests update some functions to have empty trailing () as for C#. Need to pick this up as an optional parse element. |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
137
|
use Data::Dumper ; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
70
|
|
|
19
|
1
|
|
|
1
|
|
6
|
use Carp ; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
89
|
|
|
20
|
1
|
|
|
1
|
|
7
|
use Parse::RecDescent; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
52
|
use VSGDR::UnitTest::TestSet; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
44
|
|
|
23
|
1
|
|
|
1
|
|
6
|
use VSGDR::UnitTest::TestSet::Test; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
34
|
|
|
24
|
1
|
|
|
1
|
|
7
|
use VSGDR::UnitTest::TestSet::Representation; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
50
|
|
|
25
|
1
|
|
|
1
|
|
7
|
use VSGDR::UnitTest::TestSet::Representation::NET; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2444
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#my %Globals ; ## temp |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#use Smart::Comments ; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#use re 'debug'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#$::RD_HINT=1; |
|
34
|
|
|
|
|
|
|
#$::RD_AUTOACTION=q { [@item] }; |
|
35
|
|
|
|
|
|
|
#$::RD_TRACE = 1; |
|
36
|
|
|
|
|
|
|
#$::RD_WARN =1; |
|
37
|
|
|
|
|
|
|
#$::RD_NO_HITEM =1; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#$::RD_HINT=1; |
|
42
|
|
|
|
|
|
|
$::RD_AUTOACTION=q { [@item] }; |
|
43
|
|
|
|
|
|
|
#$::RD_TRACE = 1; |
|
44
|
|
|
|
|
|
|
#$::RD_WARN =1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $grammar_pass1 = q{ |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ my %testConditions = () ; |
|
49
|
|
|
|
|
|
|
my %testConditions_2 = () ; |
|
50
|
|
|
|
|
|
|
my %resources = () ; |
|
51
|
|
|
|
|
|
|
$resources{CONDITIONS} = () ; |
|
52
|
|
|
|
|
|
|
my %TESTACTIONS = () ; |
|
53
|
|
|
|
|
|
|
my %actions = () ; |
|
54
|
|
|
|
|
|
|
my %globals = () ; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
start: m{(?>\A.*? (?=Public \s Class) )}sx { %testConditions = () ; |
|
59
|
|
|
|
|
|
|
%testConditions_2 = () ; |
|
60
|
|
|
|
|
|
|
%resources = () ; |
|
61
|
|
|
|
|
|
|
$resources{CONDITIONS} = () ; |
|
62
|
|
|
|
|
|
|
%TESTACTIONS = () ; |
|
63
|
|
|
|
|
|
|
%actions = () ; |
|
64
|
|
|
|
|
|
|
%globals = () ; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
#VSGDR::UnitTest::TestSet::Dump(@_) ; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
class |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
m{(?>.*?(?=\\s*_))}sx |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
testmethod(s) |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
m{ .* (?= \z ) }xsm |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
m{ \z }sx { $return = { GLOBALS => \%globals, RESOURCES => \%resources, ACTIONS => \%actions, TESTCONDITIONS => \%testConditions, TESTCONDITIONS_DETAILS => \%testConditions_2, TESTACTIONS => \%TESTACTIONS } ; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
class_name: m{\w++}sx { $globals{CLASSNAME} = $item[1]; $globals{NAMESPACE} = $globals{CLASSNAME} ; $globals{CLEANUPACTION} = 'testCleanupAction'; $globals{INITIALIZEACTION} = 'testInitializeAction' ; |
|
82
|
|
|
|
|
|
|
[@item] ; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
class: /Public Class / class_name |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
testmethodname: m{\w++}sx { $globals{TESTS}{$item[1]}{NAME} = $item[1]; |
|
89
|
|
|
|
|
|
|
[@item] ; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
testdata_name: m{\w++}sx { if ( defined $arg[0] and $arg[0] ne '' ) { $globals{TESTS}{$arg[0]}{ACTION} = $item[1] } ; |
|
92
|
|
|
|
|
|
|
[@item] ; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
testdata: /Dim testActions As DatabaseTestActions = Me\./ testdata_name[ $arg[0] ] |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
testmethod: /\\s*_\s+Public\s+Sub/ testmethodname /\(\)/ testdata[ $item[2][1] ] /.*?(?=(?:\\s*_)|(?:End Class))/s |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
}; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $grammar_pass2 = q{ |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
{ my %testConditions = () ; |
|
106
|
|
|
|
|
|
|
my %testConditions_2 = () ; |
|
107
|
|
|
|
|
|
|
my %resources = () ; |
|
108
|
|
|
|
|
|
|
$resources{CONDITIONS} = () ; |
|
109
|
|
|
|
|
|
|
my %TESTACTIONS = () ; |
|
110
|
|
|
|
|
|
|
my %actions = () ; |
|
111
|
|
|
|
|
|
|
my %globals = () ; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
start: m{(?>\A.*? (?=Public \s Class) )}sx { %testConditions = () ; |
|
116
|
|
|
|
|
|
|
%testConditions_2 = () ; |
|
117
|
|
|
|
|
|
|
%resources = () ; |
|
118
|
|
|
|
|
|
|
$resources{CONDITIONS} = () ; |
|
119
|
|
|
|
|
|
|
%TESTACTIONS = () ; |
|
120
|
|
|
|
|
|
|
%actions = () ; |
|
121
|
|
|
|
|
|
|
%globals = %{$arg[0]} ; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
class |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# m{(?>.*?(?=\\s*_))}sx |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
#testmethod(s) |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
m{(?> .*? (?:Private \s+ Sub \s+ InitializeComponent\(\) \s+ ) )}sx |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
condition_or_testaction(s) |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
m{.*?(?=\s*[''])}s |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
resource_test_action(s) |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
m{ .* (?= \z ) }xsm |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
m{ \z }sx { $return = { GLOBALS => \%globals, RESOURCES => \%resources, ACTIONS => \%actions, TESTCONDITIONS => \%testConditions, TESTCONDITIONS_DETAILS => \%testConditions_2, TESTACTIONS => \%TESTACTIONS } ; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
condition_or_testaction: condition | testaction | resourcemanager |
|
144
|
|
|
|
|
|
|
testaction: /Dim/ m{\w++}sx /As/ /Microsoft\.Data\.Schema\.UnitTesting\.DatabaseTestAction/ |
|
145
|
|
|
|
|
|
|
resourcemanager: /Dim/ m{\w++}sx /As/ /System\.ComponentModel\.ComponentResourceManager/ /=/ /New/ /System\.ComponentModel\.ComponentResourceManager\(GetType\(\w++\)\)/ |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
resource_test_action: resource | test | action |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
class_name: m{\w++}sx { $globals{CLASSNAME} = $item[1]; $globals{NAMESPACE} = $globals{CLASSNAME} ; $globals{CLEANUPACTION} = 'testCleanupAction'; $globals{INITIALIZEACTION} = 'testInitializeAction' ; |
|
151
|
|
|
|
|
|
|
[@item] ; |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
class: /Public Class / class_name |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
testmethodname: m{\w++}sx { $globals{TESTS}{$item[1]}{NAME} = $item[1]; |
|
158
|
|
|
|
|
|
|
[@item] ; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
testdata_name: m{\w++}sx { if ( defined $arg[0] and $arg[0] ne '' ) { $globals{TESTS}{$arg[0]}{ACTION} = $item[1] } ; |
|
161
|
|
|
|
|
|
|
[@item] ; |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
testdata: /Dim testActions As DatabaseTestActions = Me\./ testdata_name[ $arg[0] ] |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
testmethod: /\\s*_\s+Public\s+Sub/ testmethodname /\(\)/ testdata[ $item[2][1] ] /.*?(?=(?:\\s*_)|(?:#Region "Designer support code"))/s |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
condition_type: m{\w++}sx |
|
170
|
|
|
|
|
|
|
condition_name: m{\w++}sx |
|
171
|
|
|
|
|
|
|
condition: /Dim/ condition_name /As/ /Microsoft\.Data\.Schema\.UnitTesting\.Conditions\./ condition_type |
|
172
|
|
|
|
|
|
|
{ $testConditions{$item[2][1]} = $item[5][1]; |
|
173
|
|
|
|
|
|
|
[@item] ; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
test_comment: m{\s*'[^']*'[^']*['']\s*} |
|
177
|
|
|
|
|
|
|
testname: m{\w++}sx |
|
178
|
|
|
|
|
|
|
testproperty: /ColumnNumber|Enabled|ExpectedValue|Name|NullExpected|ResultSet|RowNumber|RowCount|ExecutionTime|Checksum|Verbose/ |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
testvalue_string: / (?: \"(?:(?:[\\\\][\"])|(?:[^\"]))*?\" )/x |
|
181
|
|
|
|
|
|
|
{ #VSGDR::UnitTest::TestSet::Dump(@item) ; |
|
182
|
|
|
|
|
|
|
$item[1] ; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
testvalue: testvalue_string |
|
185
|
|
|
|
|
|
|
| /System\.TimeSpan\.Parse\("[\d:]*"\)/x |
|
186
|
|
|
|
|
|
|
| /(?: \w+ ) /x |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
test_element: testname /\./ testproperty /=/ testvalue |
|
189
|
|
|
|
|
|
|
{ $testConditions_2{$item[1][1]}{$item[3][1]} = $item[5][1]; |
|
190
|
|
|
|
|
|
|
[@item] ; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
test_element: /resources\.ApplyResources\(\w+,/ testvalue_string /\)/ |
|
193
|
|
|
|
|
|
|
{ [@item] ; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
test: test_comment test_element(s) |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
action_comment: m{\s*'[^']*'[^']*['']\s*} |
|
199
|
|
|
|
|
|
|
action_type: /PosttestAction|PretestAction|TestAction/ |
|
200
|
|
|
|
|
|
|
action_name: m{\w++}sx |
|
201
|
|
|
|
|
|
|
action_element: /Me\./ testdata_name /\./ action_type /=/ action_name |
|
202
|
|
|
|
|
|
|
{ $actions{$item[2][1]}{$item[4][1]}=$item[6][1]; |
|
203
|
|
|
|
|
|
|
my $testAction = $item[2][1] ; |
|
204
|
|
|
|
|
|
|
my $testActionDataValue = $item[6][1] ; |
|
205
|
|
|
|
|
|
|
$testActionDataValue =~ s{ _ (?: PosttestAction|PretestAction|TestAction ) }{}x; |
|
206
|
|
|
|
|
|
|
$TESTACTIONS{$testActionDataValue} = $testAction if $testActionDataValue !~ m{\A nothing \z}ix ; |
|
207
|
|
|
|
|
|
|
[@item] ; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
action: action_comment action_element(s) |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
resource_comment: m{\s*'[^']*'[^']*['']\s*} |
|
213
|
|
|
|
|
|
|
resource_name: m{\w++}sx |
|
214
|
|
|
|
|
|
|
resource_name_string: m{"\w++"}sx |
|
215
|
|
|
|
|
|
|
resource_element: /resources\.ApplyResources\(/ resource_name /,/ resource_name_string /\)/ |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# reject this parse if it doesn't apply to some testaction resource. |
|
218
|
|
|
|
|
|
|
# relies on us being able to parse the test name first !!!!!!! |
|
219
|
|
|
|
|
|
|
# if we don't do this then the test condition resource can get mixed up with it |
|
220
|
|
|
|
|
|
|
# leading to early parse condition 2 termination |
|
221
|
|
|
|
|
|
|
# at fault is the optionality of resource_condition below. |
|
222
|
|
|
|
|
|
|
# viz resource_condition(s?) |
|
223
|
|
|
|
|
|
|
# |
|
224
|
|
|
|
|
|
|
# BUT ** If a condition has the same name as a test ( ie like the prefix of a test action, |
|
225
|
|
|
|
|
|
|
# the check to determine resource or test condition fails. |
|
226
|
|
|
|
|
|
|
# We've strengthened it, but it might not ultimately be fixable. |
|
227
|
|
|
|
|
|
|
# A better way may be to check the final element of $item[2][1] |
|
228
|
|
|
|
|
|
|
# to see if it is TestAction/PretestAction/PostTestaction, AFAIK |
|
229
|
|
|
|
|
|
|
# this can't be meddled with by the user. However somefool might name a test or |
|
230
|
|
|
|
|
|
|
# condition TestAction etc, so it still isn't fool-proof in isolation. |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
{ my $x = $item[2][1] ; |
|
233
|
|
|
|
|
|
|
$x =~ s/[_][^_]*$// ; |
|
234
|
|
|
|
|
|
|
#VSGDR::UnitTest::TestSet::Dump(@item) ; |
|
235
|
|
|
|
|
|
|
#VSGDR::UnitTest::TestSet::Dump($x) ; |
|
236
|
|
|
|
|
|
|
if ( exists($testConditions{$x}) && ! exists($globals{TESTS}{$x})) { |
|
237
|
|
|
|
|
|
|
undef ; |
|
238
|
|
|
|
|
|
|
} |
|
239
|
|
|
|
|
|
|
else { |
|
240
|
|
|
|
|
|
|
$resources{$item[2][1]}=1; |
|
241
|
|
|
|
|
|
|
[@item] ; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
resource_condition: resource_name /\.Conditions\.Add\(/ condition_name /\)/ |
|
246
|
|
|
|
|
|
|
{ push (@{$resources{CONDITIONS}{$item[1][1]}},$item[3][1]); |
|
247
|
|
|
|
|
|
|
[@item] ; |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
resource: resource_comment resource_condition(s?) resource_element |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
}; |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub _init { |
|
255
|
|
|
|
|
|
|
|
|
256
|
0
|
|
|
0
|
|
|
local $_ = undef ; |
|
257
|
|
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
|
my $self = shift ; |
|
259
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self ; |
|
260
|
0
|
0
|
|
|
|
|
my $ref = shift or croak "no arg"; |
|
261
|
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
my $parser1 = new Parse::RecDescent($grammar_pass1); |
|
263
|
0
|
|
|
|
|
|
my $parser2 = new Parse::RecDescent($grammar_pass2); |
|
264
|
0
|
|
|
|
|
|
$self->{PARSER1} = $parser1 ; |
|
265
|
0
|
|
|
|
|
|
$self->{PARSER2} = $parser2 ; |
|
266
|
|
|
|
|
|
|
# $self->{PARSER} = \&VSGDR::UnitTest::TestSet::Representation::NET::VB ; |
|
267
|
|
|
|
|
|
|
|
|
268
|
0
|
|
|
|
|
|
return ; |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
sub representationType { |
|
273
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
|
274
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self'; |
|
275
|
0
|
|
|
|
|
|
return 'VB' ; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
# ** ######################################################################################## |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub trim { |
|
282
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
|
283
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self'; |
|
284
|
0
|
0
|
|
|
|
|
my $code = shift or croak 'no code' ; |
|
285
|
|
|
|
|
|
|
# |
|
286
|
|
|
|
|
|
|
# $code =~ s/\A.*?Public Class/Public Class/ms; |
|
287
|
0
|
|
|
|
|
|
$code =~ s{" \s? & \s _\s*"}{}msgx; # join split strings |
|
288
|
0
|
|
|
|
|
|
$code =~ s{resources\.GetString\(("[^""]*?")\)}{$1}msgx; # strip out usage of resources.GetString() and just keep the string |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
# $code =~ s{ Dim\s+[\w]+\s+As\s+ # strip out variable declarations that we aren't interested in |
|
291
|
|
|
|
|
|
|
# (?: |
|
292
|
|
|
|
|
|
|
# (?: Microsoft\.Data\.Schema\.UnitTesting\.DatabaseTestAction) |
|
293
|
|
|
|
|
|
|
# | (?: System\.ComponentModel\.ComponentResourceManager\s+=\s+New\s+System\.ComponentModel\.ComponentResourceManager\(GetType\([\w]+\)\)) |
|
294
|
|
|
|
|
|
|
# ) |
|
295
|
|
|
|
|
|
|
# }{}msgx ; |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
# $code =~ s{Microsoft\.Data\.Schema\.UnitTesting\.Conditions} |
|
298
|
|
|
|
|
|
|
# {MS\.D\.S\.UT\.C}msgx; # shorten file |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# $code =~ s/End\sSub\s+#End\sRegion\s+#Region\s"Additional\stest\sattributes".*\z//ms; |
|
302
|
|
|
|
|
|
|
#warn Dumper $code ; |
|
303
|
0
|
|
|
|
|
|
return $code ; |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
# ** ######################################################################################## |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
## -- ** --- |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub declareVariable { |
|
312
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
|
313
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
314
|
0
|
0
|
|
|
|
|
my $type = shift or croak 'no type' ; # $condition->conditionName() |
|
315
|
0
|
0
|
|
|
|
|
my $var = shift or croak 'no var' ; # $condition->conditionName() |
|
316
|
0
|
|
|
|
|
|
my $res = "" ; |
|
317
|
0
|
|
|
|
|
|
$res .= "Dim " . $var . " As " . $type ; |
|
318
|
0
|
|
|
|
|
|
return $res; |
|
319
|
|
|
|
|
|
|
} |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub declareAndCreateVariable { |
|
322
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
|
323
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
324
|
0
|
0
|
|
|
|
|
my $type = shift or croak 'no type' ; |
|
325
|
0
|
0
|
|
|
|
|
my $var = shift or croak 'no var' ; |
|
326
|
0
|
0
|
|
|
|
|
my $constructor = shift or croak 'no $constructor' ; |
|
327
|
0
|
|
|
|
|
|
my $res = "" ; |
|
328
|
0
|
|
|
|
|
|
$res .= "Dim" . " " . $var . " As " . $type . " = " . $self->newKeyWord() . " " . $constructor ; |
|
329
|
0
|
|
|
|
|
|
return $res; |
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
# ** #################################################################### |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
sub icHeader { |
|
339
|
|
|
|
|
|
|
|
|
340
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
|
341
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
342
|
|
|
|
|
|
|
|
|
343
|
0
|
|
|
|
|
|
return <<"EOF"; |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
#Region "Designer support code" |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
'NOTE: The following procedure is required by the Designer |
|
348
|
|
|
|
|
|
|
'It can be modified using the Designer. |
|
349
|
|
|
|
|
|
|
'Do not modify it using the code editor. |
|
350
|
|
|
|
|
|
|
_ |
|
351
|
|
|
|
|
|
|
Private Sub InitializeComponent() |
|
352
|
|
|
|
|
|
|
EOF |
|
353
|
|
|
|
|
|
|
#' |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
sub icFooter { |
|
358
|
|
|
|
|
|
|
|
|
359
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
|
360
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
361
|
|
|
|
|
|
|
|
|
362
|
0
|
|
|
|
|
|
return <<"EOF"; |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
End Sub |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
#End Region |
|
367
|
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
EOF |
|
369
|
|
|
|
|
|
|
} |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub Tests { |
|
374
|
|
|
|
|
|
|
|
|
375
|
0
|
|
|
0
|
0
|
|
local $_ = undef ; |
|
376
|
|
|
|
|
|
|
|
|
377
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
378
|
0
|
0
|
|
|
|
|
my $ra_tests = shift or croak 'no tests' ; |
|
379
|
0
|
|
|
|
|
|
my @tests = @$ra_tests ; |
|
380
|
|
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
|
my $p1 = ' '; |
|
382
|
0
|
|
|
|
|
|
my $p2 = ' '; |
|
383
|
0
|
|
|
|
|
|
my $p3 = ' '; |
|
384
|
0
|
|
|
|
|
|
my $res = "" ; |
|
385
|
|
|
|
|
|
|
|
|
386
|
0
|
|
|
|
|
|
foreach my $test ( @tests) { |
|
387
|
|
|
|
|
|
|
|
|
388
|
0
|
|
|
|
|
|
$res .= "${p1} _\n"; |
|
389
|
0
|
|
|
|
|
|
$res .= "${p1}Public Sub ".$test->testName()."()\n"; |
|
390
|
0
|
|
|
|
|
|
$res .= "${p2}Dim testActions As DatabaseTestActions = Me.".$test->testActionDataName()."\n"; |
|
391
|
|
|
|
|
|
|
|
|
392
|
0
|
|
|
|
|
|
$res .= $self->Lang_testsection('pre-test','PretestAction','pretestResults','Executing pre-test script...','PrivilegedContext') ; |
|
393
|
0
|
|
|
|
|
|
$res .= $self->Lang_testsection('test','TestAction','testResults','Executing test script...','ExecutionContext') ; |
|
394
|
0
|
|
|
|
|
|
$res .= $self->Lang_testsection('post-test','PosttestAction','posttestResults','Executing post-test script...','PrivilegedContext') ; |
|
395
|
|
|
|
|
|
|
|
|
396
|
0
|
|
|
|
|
|
$res .= "${p1}End Sub\n"; |
|
397
|
0
|
|
|
|
|
|
$res .= "\n"; |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
} |
|
400
|
|
|
|
|
|
|
|
|
401
|
0
|
|
|
|
|
|
return $res; |
|
402
|
|
|
|
|
|
|
} |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
sub Lang_testsection { |
|
406
|
|
|
|
|
|
|
|
|
407
|
0
|
|
|
0
|
0
|
|
local $_ = undef ; |
|
408
|
|
|
|
|
|
|
|
|
409
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
410
|
0
|
0
|
|
|
|
|
my $arg1 = shift or croak 'no comment'; |
|
411
|
0
|
0
|
|
|
|
|
my $arg2 = shift or croak 'no method'; |
|
412
|
0
|
0
|
|
|
|
|
my $arg3 = shift or croak 'no results'; |
|
413
|
0
|
0
|
|
|
|
|
my $arg4 = shift or croak 'no text'; |
|
414
|
0
|
0
|
|
|
|
|
my $arg5 = shift or croak 'no context'; |
|
415
|
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
my $p1 = ' '; |
|
417
|
0
|
|
|
|
|
|
my $p2 = ' '; |
|
418
|
0
|
|
|
|
|
|
my $p3 = ' '; |
|
419
|
0
|
|
|
|
|
|
my $res = "" ; |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
#print Dumper ${arg2} ; |
|
422
|
|
|
|
|
|
|
|
|
423
|
0
|
|
|
|
|
|
$res .= "${p2}'Execute the ${arg1} script\n"; |
|
424
|
0
|
|
|
|
|
|
$res .= "${p2}'\n"; |
|
425
|
|
|
|
|
|
|
|
|
426
|
0
|
|
|
|
|
|
$res .= "${p2}System.Diagnostics.Trace.WriteLineIf((Not (testActions.".${arg2}.") Is Nothing), \"${arg4}\")\n"; |
|
427
|
0
|
|
|
|
|
|
$res .= "${p2}Dim ".${arg3}."() As ExecutionResult = TestService.Execute(Me.".${arg5}.", Me.PrivilegedContext, testActions.".${arg2}.")\n"; |
|
428
|
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
|
return $res ; |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
} |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
# ** ###################################################################################### |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
sub Header { |
|
437
|
|
|
|
|
|
|
|
|
438
|
0
|
|
|
0
|
0
|
|
local $_ = undef ; |
|
439
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
440
|
0
|
0
|
|
|
|
|
my $namespace = shift or croak "No namespace supplied" ; |
|
441
|
0
|
0
|
|
|
|
|
my $class = shift or croak "No Class" ; |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
|
|
444
|
0
|
|
|
|
|
|
return <<"EOF"; |
|
445
|
|
|
|
|
|
|
Imports System |
|
446
|
|
|
|
|
|
|
Imports System.Text |
|
447
|
|
|
|
|
|
|
Imports System.Collections.Generic |
|
448
|
|
|
|
|
|
|
Imports Microsoft.VisualStudio.TestTools.UnitTesting |
|
449
|
|
|
|
|
|
|
Imports Microsoft.Data.Schema.UnitTesting |
|
450
|
|
|
|
|
|
|
Imports Microsoft.Data.Schema.UnitTesting.Conditions |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
_ |
|
454
|
|
|
|
|
|
|
Public Class ${class} |
|
455
|
|
|
|
|
|
|
Inherits DatabaseTestClass |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
Sub New() |
|
458
|
|
|
|
|
|
|
InitializeComponent() |
|
459
|
|
|
|
|
|
|
End Sub |
|
460
|
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
_ |
|
462
|
|
|
|
|
|
|
Public Sub TestInitialize() |
|
463
|
|
|
|
|
|
|
InitializeTest() |
|
464
|
|
|
|
|
|
|
End Sub |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
_ |
|
467
|
|
|
|
|
|
|
Public Sub TestCleanup() |
|
468
|
|
|
|
|
|
|
CleanupTest() |
|
469
|
|
|
|
|
|
|
End Sub |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
EOF |
|
472
|
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
} |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
sub Footer { |
|
477
|
|
|
|
|
|
|
|
|
478
|
0
|
|
|
0
|
0
|
|
local $_ = undef ; |
|
479
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
|
480
|
0
|
0
|
|
|
|
|
my $ra_tests = shift or croak 'no tests' ; |
|
481
|
0
|
|
|
|
|
|
my @tests = @$ra_tests ; |
|
482
|
|
|
|
|
|
|
|
|
483
|
0
|
|
|
|
|
|
my $p1 = ' '; |
|
484
|
0
|
|
|
|
|
|
my $p2 = ' '; |
|
485
|
0
|
|
|
|
|
|
my $res = "" ; |
|
486
|
|
|
|
|
|
|
|
|
487
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
|
488
|
0
|
|
|
|
|
|
$res .= "${p2}Private " . $test->testActionDataName() . " As DatabaseTestActions\n"; |
|
489
|
|
|
|
|
|
|
} |
|
490
|
|
|
|
|
|
|
|
|
491
|
0
|
|
|
|
|
|
return <<"EOF"; |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
#Region "Additional test attributes" |
|
494
|
|
|
|
|
|
|
' |
|
495
|
|
|
|
|
|
|
' You can use the following additional attributes as you write your tests: |
|
496
|
|
|
|
|
|
|
' |
|
497
|
|
|
|
|
|
|
' Use ClassInitialize to run code before running the first test in the class |
|
498
|
|
|
|
|
|
|
' Public Shared Sub MyClassInitialize(ByVal testContext As TestContext) |
|
499
|
|
|
|
|
|
|
' End Sub |
|
500
|
|
|
|
|
|
|
' |
|
501
|
|
|
|
|
|
|
' Use ClassCleanup to run code after all tests in a class have run |
|
502
|
|
|
|
|
|
|
' Public Shared Sub MyClassCleanup() |
|
503
|
|
|
|
|
|
|
' End Sub |
|
504
|
|
|
|
|
|
|
' |
|
505
|
|
|
|
|
|
|
#End Region |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
${res} |
|
508
|
|
|
|
|
|
|
End Class |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
EOF |
|
511
|
|
|
|
|
|
|
#' |
|
512
|
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
} |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
sub typeExtractor { |
|
517
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
518
|
0
|
|
|
|
|
|
return "GetType" |
|
519
|
|
|
|
|
|
|
} |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
sub newKeyWord { |
|
522
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
523
|
0
|
|
|
|
|
|
return "New" ; |
|
524
|
|
|
|
|
|
|
} |
|
525
|
|
|
|
|
|
|
sub selfKeyWord { |
|
526
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
527
|
0
|
|
|
|
|
|
return "Me" ; |
|
528
|
|
|
|
|
|
|
} |
|
529
|
|
|
|
|
|
|
sub functionOpenDelimiter { |
|
530
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
531
|
0
|
|
|
|
|
|
return "" ; |
|
532
|
|
|
|
|
|
|
} |
|
533
|
|
|
|
|
|
|
sub functionCloseDelimiter { |
|
534
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
535
|
0
|
|
|
|
|
|
return "" ; |
|
536
|
|
|
|
|
|
|
} |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
sub functionDelimiters { |
|
539
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
540
|
0
|
|
|
|
|
|
return "" ; |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
sub lineTerminator { |
|
543
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
544
|
0
|
|
|
|
|
|
return "" ; |
|
545
|
|
|
|
|
|
|
} |
|
546
|
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
sub quoteChars { |
|
548
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
549
|
0
|
|
|
|
|
|
return "'" ; |
|
550
|
|
|
|
|
|
|
} |
|
551
|
|
|
|
|
|
|
sub true { |
|
552
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
553
|
0
|
|
|
|
|
|
return 'True' ; |
|
554
|
|
|
|
|
|
|
} |
|
555
|
|
|
|
|
|
|
sub false { |
|
556
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
557
|
0
|
|
|
|
|
|
return 'False' ; |
|
558
|
|
|
|
|
|
|
} |
|
559
|
|
|
|
|
|
|
sub null { |
|
560
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
561
|
0
|
|
|
|
|
|
return 'Nothing' ; |
|
562
|
|
|
|
|
|
|
} |
|
563
|
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
sub convertKeyWord { |
|
565
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
566
|
0
|
|
|
|
|
|
my $KW = shift ; |
|
567
|
0
|
0
|
|
|
|
|
croak 'No key word' if not defined ($KW) ; |
|
568
|
|
|
|
|
|
|
|
|
569
|
0
|
0
|
|
|
|
|
return 'True' if $KW =~ m{^true$}ix ; |
|
570
|
0
|
0
|
|
|
|
|
return 'False' if $KW =~ m{^false$}ix ; |
|
571
|
0
|
0
|
|
|
|
|
return 'Nothing' if $KW =~ m{^(?:"nothing"|nothing|null)$}ix ; |
|
572
|
0
|
|
|
|
|
|
return $KW ; # otherwise |
|
573
|
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
} |
|
575
|
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
sub start { |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
#warn Dumper @_ ; |
|
580
|
|
|
|
|
|
|
### Start |
|
581
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
|
582
|
0
|
|
|
|
|
|
my $code = shift ; |
|
583
|
0
|
0
|
|
|
|
|
croak 'no code' if ! defined $code ; |
|
584
|
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
my %testConditions = () ; |
|
586
|
0
|
|
|
|
|
|
my %testConditions_2 = () ; |
|
587
|
0
|
|
|
|
|
|
my %resources = () ; |
|
588
|
0
|
|
|
|
|
|
keys %resources = 8192 ; |
|
589
|
0
|
|
|
|
|
|
$resources{CONDITIONS} = {} ; |
|
590
|
0
|
|
|
|
|
|
keys %{$resources{CONDITIONS}} = 8192 ; |
|
|
0
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
|
|
592
|
0
|
|
|
|
|
|
my %actions = () ; |
|
593
|
0
|
|
|
|
|
|
my %globals = () ; |
|
594
|
|
|
|
|
|
|
|
|
595
|
0
|
|
|
|
|
|
keys %testConditions = 8192 ; |
|
596
|
0
|
|
|
|
|
|
keys %testConditions_2 = 8192 ; |
|
597
|
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
|
|
600
|
0
|
|
|
|
|
|
$code =~ s{(?>\A.*? (?=Public \s Class) )}{}sx ; |
|
601
|
0
|
|
|
|
|
|
my $class_name; |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
### ClassName |
|
604
|
0
|
0
|
|
|
|
|
$class_name = $1 if $code =~ m{Public \s Class \s+ (\w++)}sx ; |
|
605
|
0
|
|
|
|
|
|
{ $globals{CLASSNAME} = $class_name; $globals{NAMESPACE} = $globals{CLASSNAME} ; $globals{CLEANUPACTION} = 'testCleanupAction'; $globals{INITIALIZEACTION} = 'testInitializeAction' ; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
|
|
607
|
0
|
|
|
|
|
|
$code =~ s{(:? .*? (?=\ \s*_))}{}sx ; |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
### Strip Methods |
|
610
|
0
|
|
|
|
|
|
while ( $code =~ m{ \ \s* _ \s+ Public \s+ Sub \s+ (?\w+) \s* \(\) \s* |
|
611
|
|
|
|
|
|
|
Dim \s testActions \s As \s DatabaseTestActions \s = \s Me \. (?\w+) |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
.*? (?= (?: (?: \ \s* _ ) |
|
614
|
|
|
|
|
|
|
| (?: \#Region \s "Designer \s support \s code" ) |
|
615
|
|
|
|
|
|
|
) |
|
616
|
|
|
|
|
|
|
) |
|
617
|
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
}gcsmx |
|
619
|
|
|
|
|
|
|
) { |
|
620
|
1
|
|
|
1
|
|
1002
|
$globals{TESTS}{$+{testmethodname}}{NAME} = $+{testmethodname} ; |
|
|
1
|
|
|
|
|
566
|
|
|
|
1
|
|
|
|
|
752
|
|
|
|
0
|
|
|
|
|
|
|
|
621
|
0
|
|
|
|
|
|
$globals{TESTS}{$+{testmethodname}}{ACTION} = $+{testdata_name} ; |
|
622
|
|
|
|
|
|
|
} |
|
623
|
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
### Builder |
|
625
|
|
|
|
|
|
|
|
|
626
|
0
|
|
|
|
|
|
$code =~ s{(?> .*? (?:Private \s+ Sub \s+ InitializeComponent\(\) \s+ ) )}{}sx ; |
|
627
|
|
|
|
|
|
|
|
|
628
|
0
|
0
|
|
|
|
|
my ($part1,$part2) = ( $1,$2 ) if $code =~ m{ ( .*? ) (?= \s* ['']) (.*) }smx ; |
|
629
|
|
|
|
|
|
|
|
|
630
|
0
|
|
|
|
|
|
while ( $part1 =~ |
|
631
|
|
|
|
|
|
|
m{ Dim \s (?\w++) \s As \s Microsoft\.Data\.Schema\.UnitTesting\.Conditions\. (?\w++) \s* |
|
632
|
|
|
|
|
|
|
}xmsgc |
|
633
|
|
|
|
|
|
|
) |
|
634
|
0
|
|
|
|
|
|
{ $testConditions{$+{condition_name}} = $+{condition_type}; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
### Builder 2 |
|
638
|
|
|
|
|
|
|
|
|
639
|
0
|
|
|
|
|
|
my $found = 1 ; |
|
640
|
0
|
|
|
|
|
|
while ( $found ) |
|
641
|
|
|
|
|
|
|
{ |
|
642
|
0
|
0
|
|
|
|
|
if ( $part2 =~ m{ \G |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
(?: |
|
644
|
|
|
|
|
|
|
(?\w++) |
|
645
|
|
|
|
|
|
|
\. (?\w++) \s = \s |
|
646
|
|
|
|
|
|
|
(? (?: " .*? " ) |
|
647
|
|
|
|
|
|
|
| (?: System\.TimeSpan\.Parse\( "[\d:]++" \) ) |
|
648
|
|
|
|
|
|
|
| (?: \w++ ) |
|
649
|
|
|
|
|
|
|
) |
|
650
|
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
) ## test condition |
|
652
|
|
|
|
|
|
|
\s*+ |
|
653
|
|
|
|
|
|
|
}gcmsx ) |
|
654
|
|
|
|
|
|
|
|
|
655
|
0
|
|
|
|
|
|
{ $testConditions_2{$+{conditionname}}{$+{conditiontype}} = $+{conditionvalue} ; |
|
656
|
|
|
|
|
|
|
} |
|
657
|
|
|
|
|
|
|
elsif ( $part2 =~ m{ \G |
|
658
|
|
|
|
|
|
|
(? \s*+ '[^']*+ \s*+ '[^']*+ \s*+ ['']\s*+ ) |
|
659
|
|
|
|
|
|
|
\s*+ |
|
660
|
|
|
|
|
|
|
#warn "@\n"; |
|
661
|
|
|
|
|
|
|
#warn $part2 ; |
|
662
|
|
|
|
|
|
|
#die; |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
}gcmsx ) {} |
|
665
|
|
|
|
|
|
|
elsif ( $part2 =~ m{ \G |
|
666
|
|
|
|
|
|
|
(?: |
|
667
|
|
|
|
|
|
|
(?\w++) |
|
668
|
|
|
|
|
|
|
\.Conditions\.Add\( (?\w++) \) |
|
669
|
|
|
|
|
|
|
) ## adding test condition to test action |
|
670
|
|
|
|
|
|
|
\s*+ |
|
671
|
|
|
|
|
|
|
}gcmsx ) |
|
672
|
0
|
|
|
|
|
|
{ unshift (@{$resources{CONDITIONS}{$+{testname2}}},$+{conditionname2}) ; |
|
|
0
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
} |
|
674
|
|
|
|
|
|
|
elsif ( $part2 =~ m{ \G |
|
675
|
|
|
|
|
|
|
Me \. (?\w++) |
|
676
|
|
|
|
|
|
|
\. (?(?:TestAction|PosttestAction|PretestAction)) \s = \s (?\w++) |
|
677
|
|
|
|
|
|
|
\s*+ |
|
678
|
|
|
|
|
|
|
}gcmsx ) |
|
679
|
0
|
|
|
|
|
|
{ $actions{$+{testname}}{$+{testactiontype}} = $+{testaction} ; |
|
680
|
|
|
|
|
|
|
} |
|
681
|
|
|
|
|
|
|
elsif ( $part2 =~ m{ \G |
|
682
|
|
|
|
|
|
|
(?: |
|
683
|
|
|
|
|
|
|
resources\.ApplyResources\( (?\w++) |
|
684
|
|
|
|
|
|
|
, \s (?"\w++") \) |
|
685
|
|
|
|
|
|
|
) ## end of build-up of test action resources |
|
686
|
|
|
|
|
|
|
\s*+ |
|
687
|
|
|
|
|
|
|
}gcmsx ) |
|
688
|
0
|
|
|
|
|
|
{ unshift (@{$resources{$+{resourcetestaction}}},$+{quotedresourcetestaction}) ; |
|
|
0
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
} |
|
690
|
|
|
|
|
|
|
elsif ( $part2 =~ m{ \G |
|
691
|
|
|
|
|
|
|
(?: |
|
692
|
|
|
|
|
|
|
(? End \s Sub ) |
|
693
|
|
|
|
|
|
|
) |
|
694
|
|
|
|
|
|
|
}gcmsx ) |
|
695
|
0
|
|
|
|
|
|
{ $found =0 ; last } |
|
|
0
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
else { |
|
698
|
0
|
|
|
|
|
|
warn "UNMATCHED CODE!\n"; |
|
699
|
0
|
|
|
|
|
|
my $first = substr($part2,0,100); |
|
700
|
0
|
|
|
|
|
|
warn $first ; |
|
701
|
0
|
|
|
|
|
|
die; |
|
702
|
|
|
|
|
|
|
} |
|
703
|
|
|
|
|
|
|
} |
|
704
|
0
|
|
|
|
|
|
return { GLOBALS => \%globals, RESOURCES => \%resources, ACTIONS => \%actions, TESTCONDITIONS => \%testConditions, TESTCONDITIONS_DETAILS => \%testConditions_2 } ; |
|
705
|
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
}; |
|
708
|
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
1; |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
__DATA__ |