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