| 1 | package VSGDR::UnitTest::TestSet::Representation::NET::VB; | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.010; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||
| 8 | #our \$VERSION = '1.04'; | ||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use parent qw(VSGDR::UnitTest::TestSet::Representation::NET) ; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 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 | ▶ | use Data::Dumper ; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Carp ; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Parse::RecDescent; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use VSGDR::UnitTest::TestSet; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use VSGDR::UnitTest::TestSet::Test; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use VSGDR::UnitTest::TestSet::Representation; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use VSGDR::UnitTest::TestSet::Representation::NET; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 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 | 1 | $::RD_AUTOACTION=q { [@item] }; | |||||||||||||||||||||||||||||
| 43 | #$::RD_TRACE = 1; | ||||||||||||||||||||||||||||||
| 44 | #$::RD_WARN =1; | ||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||
| 46 | 1 | 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{(?>.*?(?=\<TestMethod\(\)\>\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: /\<TestMethod\(\)\>\s*_\s+Public\s+Sub/ testmethodname /\(\)/ testdata[ $item[2][1] ] /.*?(?=(?:\<TestMethod\(\)\>\s*_)|(?:End Class))/s | ||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||
| 100 | }; | ||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||
| 103 | 1 | 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{(?>.*?(?=\<TestMethod\(\)\>\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: /\<TestMethod\(\)\>\s*_\s+Public\s+Sub/ testmethodname /\(\)/ testdata[ $item[2][1] ] /.*?(?=(?:\<TestMethod\(\)\>\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 | ▶ | local $_ = undef ; | ||||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||
| 258 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | my $class = ref($self) || $self ; | ||||||||||||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | my $ref = shift or croak "no arg"; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | ▶ | local $_ = undef; | ||||||||||||||||||||||||||||
|
Subroutine
representationType: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | my $self = shift or croak 'no self'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 275 | 0 | return 'VB' ; | |||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||
| 279 | # ** ######################################################################################## | ||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||
| 281 | sub trim { | ||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | local $_ = undef; | ||||||||||||||||||||||||||||
|
Subroutine
trim: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | my $self = shift or croak 'no self'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | my $code = shift or croak 'no code' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | ▶ | local $_ = undef; | ||||||||||||||||||||||||||||
|
Subroutine
declareVariable: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | my $type = shift or croak 'no type' ; # $condition->conditionName() | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | my $var = shift or croak 'no var' ; # $condition->conditionName() | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 316 | 0 | my $res = "" ; | |||||||||||||||||||||||||||||
| 317 | 0 | $res .= "Dim " . $var . " As " . $type ; | |||||||||||||||||||||||||||||
| 318 | 0 | return $res; | |||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||
| 321 | sub declareAndCreateVariable { | ||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | local $_ = undef; | ||||||||||||||||||||||||||||
|
Subroutine
declareAndCreateVariable: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | my $type = shift or croak 'no type' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | my $var = shift or croak 'no var' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | my $constructor = shift or croak 'no $constructor' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | ▶ | local $_ = undef; | ||||||||||||||||||||||||||||
|
Subroutine
icHeader: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | <System.Diagnostics.DebuggerStepThrough()> _ | ||||||||||||||||||||||||||||||
| 351 | Private Sub InitializeComponent() | ||||||||||||||||||||||||||||||
| 352 | EOF | ||||||||||||||||||||||||||||||
| 353 | #' | ||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||
| 357 | sub icFooter { | ||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | local $_ = undef; | ||||||||||||||||||||||||||||
|
Subroutine
icFooter: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | ▶ | local $_ = undef ; | ||||||||||||||||||||||||||||
|
Subroutine
Tests: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | my $ra_tests = shift or croak 'no tests' ; | ||||||||||||||||||||||||||||
|
Branch: 1 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 .= "${p1}<TestMethod()> _\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 | ▶ | local $_ = undef ; | ||||||||||||||||||||||||||||
|
Subroutine
Lang_testsection: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | my $arg1 = shift or croak 'no comment'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | my $arg2 = shift or croak 'no method'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | my $arg3 = shift or croak 'no results'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | my $arg4 = shift or croak 'no text'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | my $arg5 = shift or croak 'no context'; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | ▶ | local $_ = undef ; | ||||||||||||||||||||||||||||
|
Subroutine
Header: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | my $namespace = shift or croak "No namespace supplied" ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | my $class = shift or croak "No Class" ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | <TestClass()> _ | ||||||||||||||||||||||||||||||
| 454 | Public Class ${class} | ||||||||||||||||||||||||||||||
| 455 | Inherits DatabaseTestClass | ||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||
| 457 | Sub New() | ||||||||||||||||||||||||||||||
| 458 | InitializeComponent() | ||||||||||||||||||||||||||||||
| 459 | End Sub | ||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||
| 461 | <TestInitialize()> _ | ||||||||||||||||||||||||||||||
| 462 | Public Sub TestInitialize() | ||||||||||||||||||||||||||||||
| 463 | InitializeTest() | ||||||||||||||||||||||||||||||
| 464 | End Sub | ||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||
| 466 | <TestCleanup()> _ | ||||||||||||||||||||||||||||||
| 467 | Public Sub TestCleanup() | ||||||||||||||||||||||||||||||
| 468 | CleanupTest() | ||||||||||||||||||||||||||||||
| 469 | End Sub | ||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||
| 471 | EOF | ||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||
| 476 | sub Footer { | ||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | local $_ = undef ; | ||||||||||||||||||||||||||||
|
Subroutine
Footer: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | my $ra_tests = shift or croak 'no tests' ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 | ' <ClassInitialize()> 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 | ' <ClassCleanup()> 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 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
typeExtractor: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 518 | 0 | return "GetType" | |||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||
| 521 | sub newKeyWord { | ||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
newKeyWord: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 523 | 0 | return "New" ; | |||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||
| 525 | sub selfKeyWord { | ||||||||||||||||||||||||||||||
| 526 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
selfKeyWord: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 527 | 0 | return "Me" ; | |||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||
| 529 | sub functionOpenDelimiter { | ||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
functionOpenDelimiter: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 531 | 0 | return "" ; | |||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||
| 533 | sub functionCloseDelimiter { | ||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
functionCloseDelimiter: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 535 | 0 | return "" ; | |||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||
| 538 | sub functionDelimiters { | ||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
functionDelimiters: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 540 | 0 | return "" ; | |||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||
| 542 | sub lineTerminator { | ||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
lineTerminator: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 544 | 0 | return "" ; | |||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||
| 547 | sub quoteChars { | ||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
quoteChars: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 549 | 0 | return "'" ; | |||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||
| 551 | sub true { | ||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
true: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 553 | 0 | return 'True' ; | |||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||
| 555 | sub false { | ||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
false: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 557 | 0 | return 'False' ; | |||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||
| 559 | sub null { | ||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
null: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 561 | 0 | return 'Nothing' ; | |||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||
| 564 | sub convertKeyWord { | ||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
convertKeyWord: not called CC=6 SCAR=37.4
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 566 | 0 | my $KW = shift ; | |||||||||||||||||||||||||||||
| 567 | 0 | ▶ | croak 'No key word' if not defined ($KW) ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | return 'True' if $KW =~ m{^true$}ix ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | return 'False' if $KW =~ m{^false$}ix ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | return 'Nothing' if $KW =~ m{^(?:"nothing"|nothing|null)$}ix ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 572 | 0 | return $KW ; # otherwise | |||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||
| 577 | sub start { | ||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||
| 579 | #warn Dumper @_ ; | ||||||||||||||||||||||||||||||
| 580 | ### Start | ||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | my $self = shift or croak 'no self' ; | ||||||||||||||||||||||||||||
|
Subroutine
start: not called CC=14 SCAR=53.5
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 582 | 0 | my $code = shift ; | |||||||||||||||||||||||||||||
| 583 | 0 | ▶ | croak 'no code' if ! defined $code ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 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 ; | |||||||||||||||||||||||||||||
| 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 | ▶ | $class_name = $1 if $code =~ m{Public \s Class \s+ (\w++)}sx ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 605 | 0 | { $globals{CLASSNAME} = $class_name; $globals{NAMESPACE} = $globals{CLASSNAME} ; $globals{CLEANUPACTION} = 'testCleanupAction'; $globals{INITIALIZEACTION} = 'testInitializeAction' ; } | |||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||
| 607 | 0 | $code =~ s{(:? .*? (?=\<TestMethod \(\) \> \s*_))}{}sx ; | |||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||
| 609 | ### Strip Methods | ||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | while ( $code =~ m{ \<TestMethod \(\) \> \s* _ \s+ Public \s+ Sub \s+ (?<testmethodname>\w+) \s* \(\) \s* | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 611 | Dim \s testActions \s As \s DatabaseTestActions \s = \s Me \. (?<testdata_name>\w+) | ||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||
| 613 | .*? (?= (?: (?: \<TestMethod \(\) \> \s* _ ) | ||||||||||||||||||||||||||||||
| 614 | | (?: \#Region \s "Designer \s support \s code" ) | ||||||||||||||||||||||||||||||
| 615 | ) | ||||||||||||||||||||||||||||||
| 616 | ) | ||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||
| 618 | }gcsmx | ||||||||||||||||||||||||||||||
| 619 | ) { | ||||||||||||||||||||||||||||||
| 620 | 0 | $globals{TESTS}{$+{testmethodname}}{NAME} = $+{testmethodname} ; | |||||||||||||||||||||||||||||
| 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 | ▶ | my ($part1,$part2) = ( $1,$2 ) if $code =~ m{ ( .*? ) (?= \s* ['']) (.*) }smx ; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | while ( $part1 =~ | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 631 | m{ Dim \s (?<condition_name>\w++) \s As \s Microsoft\.Data\.Schema\.UnitTesting\.Conditions\. (?<condition_type>\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 ) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 641 | { | ||||||||||||||||||||||||||||||
| 642 | 0 | ▶ | if ( $part2 =~ m{ \G | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 643 | (?: | ||||||||||||||||||||||||||||||
| 644 | (?<conditionname>\w++) | ||||||||||||||||||||||||||||||
| 645 | \. (?<conditiontype>\w++) \s = \s | ||||||||||||||||||||||||||||||
| 646 | (?<conditionvalue> (?: " .*? " ) | ||||||||||||||||||||||||||||||
| 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 | (?<commentblock> \s*+ '[^']*+ \s*+ '[^']*+ \s*+ ['']\s*+ ) | ||||||||||||||||||||||||||||||
| 659 | \s*+ | ||||||||||||||||||||||||||||||
| 660 | #warn "@\n"; | ||||||||||||||||||||||||||||||
| 661 | #warn $part2 ; | ||||||||||||||||||||||||||||||
| 662 | #die; | ||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||
| 664 | }gcmsx ) {} | ||||||||||||||||||||||||||||||
| 665 | elsif ( $part2 =~ m{ \G | ||||||||||||||||||||||||||||||
| 666 | (?: | ||||||||||||||||||||||||||||||
| 667 | (?<testname2>\w++) | ||||||||||||||||||||||||||||||
| 668 | \.Conditions\.Add\( (?<conditionname2>\w++) \) | ||||||||||||||||||||||||||||||
| 669 | ) ## adding test condition to test action | ||||||||||||||||||||||||||||||
| 670 | \s*+ | ||||||||||||||||||||||||||||||
| 671 | }gcmsx ) | ||||||||||||||||||||||||||||||
| 672 | 0 | { unshift (@{$resources{CONDITIONS}{$+{testname2}}},$+{conditionname2}) ; | |||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||
| 674 | elsif ( $part2 =~ m{ \G | ||||||||||||||||||||||||||||||
| 675 | Me \. (?<testname>\w++) | ||||||||||||||||||||||||||||||
| 676 | \. (?<testactiontype>(?:TestAction|PosttestAction|PretestAction)) \s = \s (?<testaction>\w++) | ||||||||||||||||||||||||||||||
| 677 | \s*+ | ||||||||||||||||||||||||||||||
| 678 | }gcmsx ) | ||||||||||||||||||||||||||||||
| 679 | 0 | { $actions{$+{testname}}{$+{testactiontype}} = $+{testaction} ; | |||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||
| 681 | elsif ( $part2 =~ m{ \G | ||||||||||||||||||||||||||||||
| 682 | (?: | ||||||||||||||||||||||||||||||
| 683 | resources\.ApplyResources\( (?<resourcetestaction>\w++) | ||||||||||||||||||||||||||||||
| 684 | , \s (?<quotedresourcetestaction>"\w++") \) | ||||||||||||||||||||||||||||||
| 685 | ) ## end of build-up of test action resources | ||||||||||||||||||||||||||||||
| 686 | \s*+ | ||||||||||||||||||||||||||||||
| 687 | }gcmsx ) | ||||||||||||||||||||||||||||||
| 688 | 0 | { unshift (@{$resources{$+{resourcetestaction}}},$+{quotedresourcetestaction}) ; | |||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||
| 690 | elsif ( $part2 =~ m{ \G | ||||||||||||||||||||||||||||||
| 691 | (?: | ||||||||||||||||||||||||||||||
| 692 | (?<endsub> End \s Sub ) | ||||||||||||||||||||||||||||||
| 693 | ) | ||||||||||||||||||||||||||||||
| 694 | }gcmsx ) | ||||||||||||||||||||||||||||||
| 695 | 0 | { $found =0 ; last } | |||||||||||||||||||||||||||||
| 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 | 1; | |||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||
| 713 | __DATA__ | ||||||||||||||||||||||||||||||