Quiq/Test/Class.pm

filter: Statementstmt 82.3% 256 / 311 Branchbran 60.3% 35 / 58 Conditioncond 39.1% 9 / 23 MC/DCmcdc 14.2% 2 / 14 Subroutinesub 89.8% 44 / 49 Podpod 96.0% 24 / 25 totaltotal 77.0% 370 / 480 CC 54 SCAR 23.7
CC
54
Cov
77%
runTests
29.9
syntaxOk
20.0
fixtureDir
12.0
CRAP 10.7
« Quiq/Url.pm ↑ Summary Quiq/Axis.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::Test::Class - Basisklasse für Testklassen
8  
9 =head1 BASE CLASS
10  
11 L<Quiq::Object>
12  
13 =head1 DESCRIPTION
14  
15 Quiq::Test::Class ist eine Basisklasse für Testklassen (Unit-Tests). Als
16 Vorbild diente Test::Class, welches nicht zu den Perl Kernmodulen
17 zählt. Einige Details sind anders, etliche Funktionalität ist
18 nicht implementiert, da sie (noch) nicht gebraucht wird.
19  
20 =head2 Testmethoden
21  
22 Quiq::Test::Class definiert sechs Typen von Testmethoden: Init(N), Foreach,
23 Startup(N), Shutdown(N), Setup(N), Teardown(N) und Test(N). Der Typ der
24 Testmethode wird als Subroutine-Attribut angegeben. Eine Testmethode
25 besitzt folgenden Aufbau:
26  
27 sub NAME : TYPE(N) {
28 my $self = shift;
29 ...
30 return;
31 }
32  
33 Hierbei ist NAME der Name der Testmethode, TYPE der Typ der
34 Testmethode und N die Anzahl der Tests innerhalb der Methode.
35 Der Typ Forech hat keinen Parameter N. Jede Testmethode besitzt einen
36 Parameter - das Testobjekt, das an alle Testmethoden übergeben wird
37 (Beschreibung siehe unten). Die Methode liefert keinen Wert zurück.
38  
39 =head2 Aufrufreihenfolge
40  
41 MEMO: Die Foreach-Methoden werden entgegen der unten stehenden Beschreibung
42 zuerst aufgerufen! Die Testzählung muss anders implementiert werden,
43 Test::More erlaubt die Angabe der Gesamtanzahl nun auch am Ende
44 (Funktion done_testing()).
45  
46 =over 2
47  
48 =item *
49  
50 Init(N)
51  
52 Zunächst werden alle Methoden vom Typ Init(N) aufgerufen. In diesen
53 Methoden können jegliche Vorabprüfungen vor Ausführung des eigentlichen
54 Testcodes durchgeführt werden, z.B. ob die Systemumgebung die Ausführung
55 der Tests überhaupt gestattet oder ob das Modul überhaupt ladbar ist.
56  
57 =item *
58  
59 Foreach
60  
61 Danach werden die Methoden vom Typ Foreach aufgerufen. Diese führen
62 selbst keine Tests durch, sondern liefern jeweils eine Liste, über
63 deren Elementen der anschließende
64 Startup/Setup/Test/Teardown/Shutdown-Zyklus
65 wiederholt durchlaufen wird. Bei jedem Iterationsschritt wird der
66 nächste Wert als zweiter Parameter (erster ist das Testobjekt) an die
67 Testmethoden übergeben.
68  
69 =item *
70  
71 Test(N)
72  
73 Die normale Testmethode ist vom Typ Test(N), sie wird im Zuge des
74 Gesamttests genau einmal aufgerufen.
75  
76 =item *
77  
78 Setup(N), Teardown(N)
79  
80 Vor jeder Testmethode vom Typ Test(N) werden alle Methoden vom
81 Typ Setup(N) aufgerufen und danach alle Methoden vom Typ Teardown(N).
82  
83 =item *
84  
85 Startup(N), Shutdown(N)
86  
87 Mit jedem Iterationsschritt werden alle Testmethoden vom Typ Startup(N)
88 aufgerufen, am Ende alle Testmethoden vom Typ Shutdown(N).
89  
90 =item *
91  
92 Ignore...
93  
94 Beginnt der Typ mit der Zeichenkette "Ignore", wird die betreffende
95 Testmethode ignoriert, also nicht ausgeführt. Dies kann angewendet
96 werden, um Testmethoden als Ganzes auszukommentieren, z.B. wenn
97 eine Reihe von Tests umgearbeitet werden.
98  
99 =back
100  
101 =head2 Testobjekt
102  
103 Das Testobjekt wird vor Aufruf der ersten Testmethode instaniiert
104 und nach Aufruf der letzten Testmethode destrukturiert, es wird
105 also an alle Testmethoden, unabhängig von ihrem Typ, übergeben.
106  
107 Mittels der Methoden set() und get() können Schlüssel/Wert-Paare
108 auf dem Test gesetzt und abgefragt werden. Auf diese Weise
109 können Objekte von den Startup- und Setup-Methoden an die
110 Test-Methoden weitergegeben und dort abgefragt werden.
111  
112 =head2 Gruppierung von Testmethoden
113  
114 Testmethoden können mittels des Subroutine-Attributs Group(Regex)
115 gruppiert werden. Diese Möglichkeit kann dazu genutzt werden,
116 um bestimmte Setup-, Test- und Teardown-Methoden zu einer Einheit
117 zusammenzufassen.
118  
119 =head2 Folgende Tests überspringen
120  
121 Mitunter sind die Testmethoden einer Testklasse ganz oder ab einem
122 bestimmten Punkt nicht anwendbar, weil bestimmte Voraussetzungen auf
123 dem System nicht vorhanden sind, z.B. ein bestimmtes Modul. In dem Fall
124 sollen alle folgenden Tests übergangen werden.
125  
126 Eine Überprüfung der Voraussetzungen in der ersten Testmethode
127 kann folgendermaßen vorgenommen werden:
128  
129 sub initMethod : Init(0) {
130 my $self = shift;
131
132 if (...auf Eigenschaft testen...) {
133 $self->skipAllTests('...Meldung...');
134 return;
135 }
136 }
137  
138 =head2 Klasse oder Programm von Tests ausnehmen
139  
140 Ist eine Klasse oder ein Programm nicht testbar, z.B. weil auf dem
141 lokalen Rechner die erforderlichen Perl-Module nicht vorhanden sind,
142 kann die der gesamte Code von Tests ausgenommen werden.
143  
144 =over 4
145  
146 =item 1.
147  
148 Unter CoTeDo wird für die Klasse oder das Programm definiert:
149  
150 TestProcedure:
151 Minimal
152  
153 =item 2.
154  
155 Als Testmethode wird definiert:
156  
157 =over 4
158  
159 =item Klasse
160  
161 # <Test> ----------------------------------------------
162
163 sub initMethod : Init(1) {
164 my $self = shift;
165
166 my $host = '<host>'; # Wir prüfen auf den Hostnamen
167
168 if (Quiq::System->hostname ne $host) {
169 $self->skipAllTests("Not on $host");
170 return;
171 }
172 $self->ok(1);
173
174 $self->useOk('<class>');
175 }
176  
177 =item Programm
178  
179 # <Test> ----------------------------------------------
180
181 sub initMethod : Init(1) {
182 my $self = shift;
183
184 my $host = '<host>'; # Wir prüfen auf den Hostnamen
185
186 if (Quiq::System->hostname ne $host) {
187 $self->skipAllTests("Not on $host");
188 return;
189 }
190 $self->ok(1);
191
192 $self->useOk('<programclass');
193 }
194  
195 =back
196  
197 =back
198  
199 Hierbei ist C<< <host> >> der Name des Hosts, auf dem der Code läuft,
200 C<< <class> >> ist die Name der Klasse bzw. C<< <programclass> >> die
201 Programmklasse, die getestet werden soll. Statt des Hostnamens
202 kann natürlich auch jede Eigenschaft geprüft werden.
203  
204 =cut
205  
206 # -----------------------------------------------------------------------------
207  
208 package Quiq::Test::Class;
209 270 ▶use base qw/Quiq::Object/;
Subroutine BEGIN: called CC=1 SCAR=0.0
210  
211 270 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
212 270 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
213 270 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
214 270 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
215  
216 270 our $VERSION = '1.240';
217  
218 270 ▶use Test::Builder ();
Subroutine BEGIN: called CC=1 SCAR=0.0
219 270 ▶use Quiq::Option;
Subroutine BEGIN: called CC=1 SCAR=0.0
220 270 ▶use Quiq::Path;
Subroutine BEGIN: called CC=1 SCAR=0.0
221 270 ▶use Quiq::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
222 270 ▶use Quiq::Converter;
Subroutine BEGIN: called CC=1 SCAR=0.0
223 270 ▶use Test::More ();
Subroutine BEGIN: called CC=1 SCAR=0.0
224 270 ▶use Quiq::System;
Subroutine BEGIN: called CC=1 SCAR=0.0
225 270 ▶use Quiq::Assert;
Subroutine BEGIN: called CC=1 SCAR=0.0
226 270 ▶use Quiq::Unindent;
Subroutine BEGIN: called CC=1 SCAR=0.0
227 270 ▶use Quiq::Test::Class::Method;
Subroutine BEGIN: called CC=1 SCAR=0.0
228  
229 # -----------------------------------------------------------------------------
230  
231 # Liste der Test-Methoden
232 270 our @Methods;
233  
234 # -----------------------------------------------------------------------------
235  
236 =head1 METHODS
237  
238 =head2 Konstruktor
239  
240 =head3 new() - Konstuktor
241  
242 =head4 Synopsis
243  
244 $test = $class->new;
245  
246 =head4 Description
247  
248 Instantiiere ein Testobjekt und liefere eine Referenz auf dieses
249 Objekt zurück.
250  
251 Das Testobjekt kennt die Testmethoden, die zur Klasse $class und
252 ihren Basisklassen gehören. Ferner ist es Träger der Attribut/Wert-Paare,
253 die mittels set() und get() gesetzt und abgefragt werden können.
254  
255 =cut
256  
257 # -----------------------------------------------------------------------------
258  
259 263 ▶sub new {
Subroutine new: called CC=5 SCAR=16.2
Pod documented
260 263 my $class = shift;
261  
262 263 my %meth;
263 263 for my $m (@Methods) {
264 # Nur Methoden berücksichtigen, die zur Klasse und
265 # ihren Basisklassen gehören.
266  
267 1038 my $code;
268 1038 ▶ if (($code = $class->can($m->name)) && $code == $m->code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($code = $class->can($m->name) and $code == $m->code) 1038 0 1038
Condition33%1/3
$code = $class->can($m->name) and $code == $m->code
!ll&&!rl&&r
001038
MC/DC0%0/2
$code = $class->can($m->name) and $code == $m->code
$code = $class->can($m->name) $code == $m->code
Truth table33%1/3
A and B
A= $code = $class->can($m->name)B= $code == $m->code
ABresult
0X0
100
111
269 1038 ▶ push @{$meth{$m->type} ||= []},$m;
Condition100%2/2
$meth{$m->type} ||= []
l!l
598440
MC/DC100%1/1
$meth{$m->type} ||= []
$meth{$m->type}
Truth table100%2/2
A
A= $meth{$m->type}
Aresult
11
00
270 }
271 }
272  
273 263 my $builder = Test::Builder->new;
274 263 $builder->exported_to($class);
275  
276 # Encoding der Umgebung setzen
277  
278 263 my $encoding = Quiq::System->encoding;
279 263 binmode $builder->output,":encoding($encoding)";
280 263 binmode $builder->failure_output,":encoding($encoding)";
281 263 binmode $builder->todo_output,":encoding($encoding)";
282  
283 # Test::Builder-Objekt, Testmethoden, Testobjekt-Attribute,
284 # SkipAll-Meldung, Skip-Meldung
285 263 return bless [$builder,\%meth,{},'',''],$class;
286 }
287  
288 # -----------------------------------------------------------------------------
289  
290 =head2 Getter/Setter
291  
292 =head3 get() - Liefere Attributwerte
293  
294 =head4 Synopsis
295  
296 $val = $test->get($key);
297 @vals = $test->get(@keys);
298  
299 =head4 Description
300  
301 Liefere die Werte @vals zu den Attributen @keys. Existiert ein
302 Attribut nicht, wird eine Exception geworfen.
303  
304 =cut
305  
306 # -----------------------------------------------------------------------------
307  
308 91 ▶sub get {
Subroutine get: called CC=4 SCAR=14.0
Pod documented
309 91 my $self = shift;
310  
311 # FIXME: Klasse auf resticted Hash umstellen
312  
313 91 my $hash = $self->[2];
314 91 my @arr;
315 91 for my $key (@_) {
316 93 ▶ if (!exists $hash->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $hash->{$key}) 0 93 93
317 0 $self->throw('TEST-00002: Unbekanntes Attribut',Key=>$key);
318 }
319 93 push @arr,$hash->{$key};
320 }
321 91 ▶ return wantarray? @arr: $arr[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 89 91
322 }
323  
324 # -----------------------------------------------------------------------------
325  
326 =head3 set() - Setze Attribut/Wert-Paare
327  
328 =head4 Synopsis
329  
330 $test->set(@keyVal);
331  
332 =head4 Description
333  
334 Setze die angegebenen Attribut/Wert-Paare auf dem Testobjekt. Die Methode
335 liefert keinen Wert zurück.
336  
337 Die Methode ermöglicht Startup- und Setup-Methoden, Attribute auf dem
338 Testobjekt zu setzen, die in den Test-, Shutdown- und
339 Teardown-Methoden abgefragt werden können.
340  
341 =cut
342  
343 # -----------------------------------------------------------------------------
344  
345 11 ▶sub set {
Subroutine set: called CC=2 SCAR=6.9
Pod documented
346 11 my $self = shift;
347 11 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 15 11 26
348 15 my $key = shift;
349 15 my $val = shift;
350 15 $self->[2]->{$key} = $val;
351 }
352 11 return;
353 }
354  
355 # -----------------------------------------------------------------------------
356  
357 =head2 Directories
358  
359 =head3 fixtureDir() - Liefere Pfad zum Fixture-Verzeichnis
360  
361 =head4 Synopsis
362  
363 $dir = $this->fixtureDir(@opt);
364 $dir = $this->fixtureDir($subpath,@opt);
365  
366 =head4 Options
367  
368 =over 4
369  
370 =item -create => $bool (Default: 0)
371  
372 Erzeuge Verzeichnis, falls es nicht existiert.
373  
374 =back
375  
376 =head4 Description
377  
378 Liefere den Pfad zum Fixture-Verzeichnis der Testklasse. Ist Parameter
379 $subpath angegeben, wird diese Zeichenkette, per / getrennt, zum Pfad
380 hinzugefügt.
381  
382 =cut
383  
384 # -----------------------------------------------------------------------------
385  
386 0 ▶sub fixtureDir {
Subroutine fixtureDir: not called CC=3 SCAR=24.8
Pod documented
387 0 my $this = shift;
388 # @_: $subPath,@opt
389  
390 0 my $create = 0;
391 0 Quiq::Option->extract(-mode=>'sloppy',\@_,
392 -create => \$create,
393 );
394  
395 0 my $dir = $this->testDir('fixture');
396 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
397 0 my $subPath = shift;
398 0 $dir .= "/$subPath";
399 }
400  
401 0 ▶ if ($create) {
Branch: 1 branch
BranchTrueFalseTotal
if ($create) 0 0 0
402 0 Quiq::Path->mkdir($dir,-recursive=>1);
403 }
404  
405 0 return $dir;
406 }
407  
408 # -----------------------------------------------------------------------------
409  
410 =head3 testDir() - Liefere Pfad zum Testverzeichnis
411  
412 =head4 Synopsis
413  
414 $dir = $this->testDir;
415 $dir = $this->testDir($subPath);
416  
417 =head4 Description
418  
419 Liefere den Pfad zum Testverzeichnis. Ist Parameter $subPath
420 angegeben, wird diese Zeichenkette, per / getrennt, zum Pfad
421 hinzugefügt.
422  
423 Das Testverzeichnis ist das Verzeichnis, in dem die Datei Test.pm
424 (Definition der Testklasse) liegt. Die Methode kann als Objekt- oder
425 als Klassemethode gerufen werden. Der Aufruf als Klassenmethode ist
426 nützlich, wenn auf die Testverzeichnisse anderer Testklassen
427 zugegriffen werden soll.
428  
429 =cut
430  
431 # -----------------------------------------------------------------------------
432  
433 5 ▶sub testDir {
Subroutine testDir: called CC=2 SCAR=6.9
Pod documented
434 5 my $class = Quiq::Object->this(shift);
435 5 my $subPath = shift;
436  
437 5 my $dir = $0;
438 5 $dir =~ s/\.[^.]*$//; # Endung entfernen
439  
440 5 ▶ $dir .= "/$subPath" if $subPath;
Branch: 1 branch
BranchTrueFalseTotal
if $subPath 2 3 5
441  
442 5 return $dir;
443 }
444  
445 # -----------------------------------------------------------------------------
446  
447 =head3 testPath() - Liefere vollständigen Pfad zu Testverzeichnis/datei
448  
449 =head4 Synopsis
450  
451 $fullPath = $this->testPath($file);
452  
453 =cut
454  
455 # -----------------------------------------------------------------------------
456  
457 17 ▶sub testPath {
Subroutine testPath: called CC=2 SCAR=7.9
Pod documented
458 17 my ($this,$path) = @_;
459  
460 17 ▶ if (-d 't') {
Branch: 1 branch
BranchTrueFalseTotal
if (-d 't') { } 17 0 17
461 # Wir sind in einem Modulverzeichnis. Per Konvention beginnen
462 # die Testdateien mit <package>/test. Diesen Präfix
463 # reduzieren zu t.
464 17 $path =~ s|^\w+/test|t|;
465 }
466 else {
467 # Übler Hack. FIXME: Beheben.
468 0 my $dir = '.cotedo/root/file';
469 0 $path = "$dir/$path";
470 }
471  
472 17 return $path;
473 }
474  
475 # -----------------------------------------------------------------------------
476  
477 =head2 Methoden
478  
479 =head3 methods() - Liefere Liste von Testmethoden
480  
481 =head4 Synopsis
482  
483 @arr = $test->methods($type);
484  
485 =head4 Description
486  
487 Liefere die Liste der Testmethoden von Typ $type.
488  
489 Folgende Typen von Testmethoden sind definiert:
490  
491 Init
492 Foreach
493 Startup
494 Setup
495 Test
496 Teardown
497 Shutdown
498  
499 =cut
500  
501 # -----------------------------------------------------------------------------
502  
503 2858 ▶sub methods {
Subroutine methods: called CC=2 SCAR=6.9
Pod documented
504 2858 my $self = shift;
505 2858 my $type = shift;
506  
507 2858 ▶ my $arr = $self->[1]->{$type} || [];
Condition100%2/2
$self->[1]{$type} || []
l!l
4442414
MC/DC100%1/1
$self->[1]{$type} || []
$self->[1]{$type}
Truth table100%2/2
A
A= $self->[1]{$type}
Aresult
11
00
508  
509 2858 return @$arr;
510 }
511  
512 # -----------------------------------------------------------------------------
513  
514 =head3 runTests() - Führe Testmethoden aus
515  
516 =head4 Synopsis
517  
518 $this->runTests;
519  
520 =head4 Description
521  
522 Führe die Tests der Testklasse bzw. des Testobjekts $this aus.
523 Die Methode liefert keinen Wert zurück.
524  
525 =cut
526  
527 # -----------------------------------------------------------------------------
528  
529 263 ▶sub runTests {
Subroutine runTests: called CC=26 SCAR=34.0
Pod documented
530 263 my ($class,$self) = Quiq::Object->this(shift);
531  
532 # Test-Objekt instantiieren, wenn als Klassenmethode gerufen
533 263 ▶ $self ||= $class->new;
Condition33%1/3
$self ||= $class->new
l!l&&r!l&&!r
02630
MC/DC0%0/2
$self ||= $class->new
$self $class->new
Truth table33%1/3
A ||= B
A= $selfB= $class->new
ABresult
1X1
011
000
534  
535 263 my @calls; # Liste der Testmethoden
536 263 my $tests = 0; # Anzahl der Tests insgesamt
537  
538 # Init-Methoden
539  
540 263 for my $meth ($self->methods('Init')) {
541 262 push @calls,[$meth];
542 262 $tests += $meth->tests;
543 }
544  
545 # Foreach-Methoden. Diese werden sofort aufgerufen und liefern
546 # die Werte, mit denen die restlichen Methoden aufgerufen werden.
547  
548 263 my @vals;
549 263 for my $meth ($self->methods('Foreach')) {
550 3 my $name = $meth->name;
551 3 push @vals,eval { $self->$name };
552 3 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 3 3
553 # FIXME: Erstmal rausbomben, später verbessern
554 0 $class->throw(
555 'TEST-00005: Foreach-Testmethode fehlgeschlagen',
556 Error => $@,
557 );
558 }
559 }
560 263 ▶ push @vals,undef if !@vals;
Branch: 1 branch
BranchTrueFalseTotal
unless @vals 260 3 263
561  
562 # Startup/Setup/Test/Teardown/Shutdown-Methoden für jeden
563 # Wert aus @val aufrufen
564  
565 # FIXME: Als Testanzahl undef erlauben, was bedeutet, dass die
566 # Anzahl der Tests unbekannt ist. Wenn wenigstens eine Methode
567
568  
569 263 for my $val (@vals) {
570 # Startup
571  
572 264 for my $meth ($self->methods('Startup')) {
573 6 push @calls,[$meth,$val];
574 6 $tests += $meth->tests;
575 }
576  
577 264 for my $meth ($self->methods('Test')) {
578 770 my $name = $meth->name;
579  
580 # Setup
581  
582 770 my $group;
583 770 for my $setup ($self->methods('Setup')) {
584 2 ▶ next if ($group = $setup->group) && $name !~ /$group/;
Branch: 1 branch
BranchTrueFalseTotal
if $group = $setup->group and not $name =~ /$group/ 0 2 2
Condition33%1/3
$group = $setup->group and not $name =~ /$group/
!ll&&!rl&&r
020
MC/DC0%0/2
$group = $setup->group and not $name =~ /$group/
$group = $setup->group not $name =~ /$group/
Truth table33%1/3
A and not(B)
A= $group = $setup->groupB= not $name =~ /$group/
ABresult
0X0
100
111
585 2 push @calls,[$setup,$val];
586 2 $tests += $setup->tests;
587 }
588  
589 # Test
590  
591 770 push @calls,[$meth,$val];
592 770 $tests += $meth->tests;
593  
594 # Teardown
595  
596 770 for my $teardown ($self->methods('Teardown')) {
597 2 ▶ next if ($group = $teardown->group) && $name !~ /$group/;
Branch: 1 branch
BranchTrueFalseTotal
if $group = $teardown->group and not $name =~ /$group/ 0 2 2
Condition33%1/3
$group = $teardown->group and not $name =~ /$group/
!ll&&!rl&&r
020
MC/DC0%0/2
$group = $teardown->group and not $name =~ /$group/
$group = $teardown->group not $name =~ /$group/
Truth table33%1/3
A and not(B)
A= $group = $teardown->groupB= not $name =~ /$group/
ABresult
0X0
100
111
598 2 push @calls,[$teardown,$val];
599 2 $tests += $teardown->tests;
600 }
601 }
602  
603 # Shutdown
604  
605 264 for my $meth ($self->methods('Shutdown')) {
606 3 push @calls,[$meth,$val];
607 3 $tests += $meth->tests;
608 }
609 }
610  
611 263 my $builder = $self->[0];
612 263 $builder->plan(tests=>$tests);
613  
614 263 my $i = 0;
615 263 for (@calls) {
616 1020 my ($meth,$arg) = @$_;
617  
618 1020 my $name = $meth->name;
619 1020 my $n = $builder->current_test+$meth->tests;
620  
621 1020 ▶ if ($ENV{'TEST_VERBOSE'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"TEST_VERBOSE"}) 0 1020 1020
622 0 ▶ my $nl = $i++? "\n": '';
Branch: 1 branch
BranchTrueFalseTotal
$i++ ? : 0 0 0
623 # Klasse/Methode ausgeben
624 # $builder->_print("$nl$class->$name");
625 }
626  
627 1020 eval { $self->$name($arg) };
628 1010 ▶ if ($@) {
Branch: 3 branches
BranchTrueFalseTotal
if ($@) { } 3 1007 1010
elsif (my $skipAllMsg = $self->[3]) { } 6 1001 1007
elsif (my $skipMsg = $self->[4]) { } 7 994 1001
629 # Exception melden und alle weiteren Tests
630 # in der Methode übergehen
631  
632 3 $builder->ok(0,$@);
633 3 for ($builder->current_test+1 .. $n) {
634 5 $builder->skip('Exception');
635 }
636 }
637 elsif (my $skipAllMsg = $self->[3]) {
638 # Alle weiteren Tests aller Testmethoden übergehen
639  
640 6 for ($builder->current_test+1 .. $tests) {
641 99 $builder->skip($skipAllMsg);
642 }
643 6 last;
644 }
645 elsif (my $skipMsg = $self->[4]) {
646 # Alle weiteren Tests der Testmethode übergehen
647  
648 7 ▶ if (defined $self->[5]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[5]) 0 7 7
649 0 $n = $builder->current_test+$self->[5];
650 }
651  
652 7 for ($builder->current_test+1 .. $n) {
653 21 $builder->skip($skipMsg);
654 }
655 7 $self->[4] = ''; # FIXME: Abschaltung besser machen
656 7 $self->[5] = undef;
657 }
658 }
659  
660 253 return;
661 }
662  
663 # -----------------------------------------------------------------------------
664  
665 =head3 skipAllTests() - Übergehe alle folgenden Tests
666  
667 =head4 Synopsis
668  
669 $test->skipAllTests($msg);
670  
671 =head4 Alias
672  
673 skipAll()
674  
675 =head4 Description
676  
677 Setze Abbruchmeldung $msg auf dem Testobjekt und übergehe alle
678 folgenden Tests aller Testmethoden. Die Methode
679 liefert keinen Wert zurück.
680  
681 =cut
682  
683 # -----------------------------------------------------------------------------
684  
685 6 ▶sub skipAllTests {
Subroutine skipAllTests: called CC=1 SCAR=0.0
Pod documented
686 6 my $self = shift;
687 6 my $msg = shift;
688  
689 # Um Warnungen à la "does not map to ascii" zu verhindern
690 6 $self->[3] = Quiq::Converter->umlautToAscii($msg);
691  
692 6 return;
693 }
694  
695 {
696 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
697 270 *skipAll = \&skipAllTests;
698 }
699  
700 # -----------------------------------------------------------------------------
701  
702 =head3 skipTest() - Brich Test-Methode ab
703  
704 =head4 Synopsis
705  
706 $test->skipTest($msg);
707 $test->skipTest($n,$msg);
708  
709 =head4 Description
710  
711 Setze Abbruchmeldung $msg auf dem Testobjekt und übergehe alle
712 folgenden Tests bzw. die nächsten $n Tests der aktuellen Testmethode.
713 Die Methode liefert keinen Wert zurück.
714  
715 =cut
716  
717 # -----------------------------------------------------------------------------
718  
719 7 ▶sub skipTest {
Subroutine skipTest: called CC=2 SCAR=7.4
Pod documented
720 7 my $self = shift;
721 # @_: $n,$msg -or- $msg
722  
723 7 ▶ if ($_[0] =~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] =~ /^\d+$/) 0 7 7
724 0 $self->[5] = shift;
725 }
726  
727 # Um Warnungen à la "does not map to ascii" zu verhindern
728 7 $self->[4] = Quiq::Converter->umlautToAscii(shift);
729  
730 7 return;
731 }
732  
733 # -----------------------------------------------------------------------------
734  
735 =head2 Testmethoden
736  
737 Die Methoden
738  
739 =over 2
740  
741 =item *
742  
743 C<ok>
744  
745 =item *
746  
747 C<is>
748  
749 =item *
750  
751 C<isnt>
752  
753 =item *
754  
755 C<like>
756  
757 =item *
758  
759 C<unlike>
760  
761 =back
762  
763 haben jeweils einen Alias C<okTest>, C<isTest> usw., der verwendet werden
764 kann, wenn in der Testklasse das Modul C<Test::More> genutzt wird.
765 Der Nameclash zwischen den C<Test::More>-Funktionen und den
766 gleich benannten C<< Quiq::Test::Class >>-Methoden kann damit umgangen werden.
767 Alte Testklassen, die C<Test::More> direkt benutzen, sollten portiert
768 werden. Wenn dies vollständig passiert ist, können die Aliase entfallen.
769  
770 =head3 useOk() - Prüfe, ob Modul geladen werden kann
771  
772 =head4 Synopsis
773  
774 $bool = $test->useOk($module);
775  
776 =cut
777  
778 # -----------------------------------------------------------------------------
779  
780 259 ▶sub useOk {
Subroutine useOk: called CC=1 SCAR=0.0
Pod documented
781 259 my $self = shift;
782 259 my $module = shift;
783 # @_: @imports
784  
785 259 local $Test::Builder::Level = $Test::Builder::Level + 1;
786 259 ▶ return Test::More::use_ok($module,@_);
Subroutine BEGIN: called CC=1 SCAR=0.0
787 }
788  
789 # -----------------------------------------------------------------------------
790  
791 =head3 syntaxOk() - Prüfe Syntax eines Perl-Programms
792  
793 =head4 Synopsis
794  
795 $bool = $test->syntaxOk($program);
796 $bool = $test->syntaxOk($program,$text);
797  
798 =head4 Arguments
799  
800 =over 4
801  
802 =item $program
803  
804 Name oder Pfad des Programms. Ist kein absoluter Pfad angegeben,
805 wird das Programm über die Environment-Variable PATH gesucht.
806  
807 =back
808  
809 =head4 Returns
810  
811 nichts
812  
813 =cut
814  
815 # -----------------------------------------------------------------------------
816  
817 0 ▶sub syntaxOk {
Subroutine syntaxOk: not called CC=4 SCAR=30.0
Pod documented
818 0 my ($self,$program,$text) = @_;
819  
820 # Um Warnungen à la "does not map to ascii" zu verhindern
821 0 $text = Quiq::Converter->umlautToAscii($text);
822  
823 # Suche Programm via PATH, wenn kein absoluter Pfad
824 0 $program = Quiq::System->searchProgram($program);
825  
826 # Prüfe Syntax per "perl -c FILE"
827  
828 0 my $cmd = "perl -c $program 2>&1 >/dev/null | grep -v OK";
829 0 my $out = `$cmd`;
830 0 ▶ my $bool = $? == 256 && $out eq '';
Condition0%0/3
$? == 256 && $out eq ''
!ll&&!rl&&r
000
MC/DC0%0/2
$? == 256 && $out eq ''
$? == 256 $out eq ''
Truth table0%0/3
A && B
A= $? == 256B= $out eq ''
ABresult
0X0
100
111
831  
832 0 local $Test::Builder::Level = $Test::Builder::Level + 1;
833 0 ▶ Test::More::ok($bool,$text || 'SYNTAX ERROR');
Condition0%0/2
$text || 'SYNTAX ERROR'
l!l
00
MC/DC0%0/1
$text || 'SYNTAX ERROR'
$text
Truth table0%0/2
A
A= $text
Aresult
11
00
834 0 ▶ if (!$bool) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($bool) 0 0 0
835 0 my $msg = qq|COMMAND: "$cmd"\n|;
836 0 $msg .= "--- OUTPUT ---\n";
837 0 $msg .= $out;
838 0 $msg .= "---- END -----\n";
839 0 $msg =~ s/^/ /mg;
840 0 Test::More::diag($msg);
841 }
842  
843 0 return $bool;
844 }
845  
846 # -----------------------------------------------------------------------------
847  
848 =head3 ok() - Prüfe, ob boolscher Wert wahr ist
849  
850 =head4 Synopsis
851  
852 $bool = $test->ok($bool);
853 $bool = $test->ok($bool,$text);
854  
855 =head4 Alias
856  
857 okTest()
858  
859 =cut
860  
861 # -----------------------------------------------------------------------------
862  
863 232 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
Pod documented
864 232 my ($self,$bool,$text) = @_;
865  
866 # Um Warnungen à la "does not map to ascii" zu verhindern
867 232 $text = Quiq::Converter->umlautToAscii($text);
868  
869 232 local $Test::Builder::Level = $Test::Builder::Level + 1;
870 232 return Test::More::ok($bool,$text);
871 }
872  
873 {
874 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
875 270 *okTest = \&ok;
876 }
877  
878 # -----------------------------------------------------------------------------
879  
880 =head3 in() - Prüfe, ob Wert dem erwarteten Wert entspricht
881  
882 =head4 Synopsis
883  
884 $bool = $test->in($got,\@expected);
885 $bool = $test->in($got,\@expected,$text);
886  
887 =head4 Alias
888  
889 inTest()
890  
891 =cut
892  
893 # -----------------------------------------------------------------------------
894  
895 0 ▶sub in {
Subroutine in: not called CC=3 SCAR=24.8
Pod documented
896 0 my ($self,$got,$expectedA,$text) = @_;
897  
898 0 my $bool = Quiq::Assert->isEnumValue($got,$expectedA);
899  
900 # Um Warnungen à la "does not map to ascii" zu verhindern
901 0 $text = Quiq::Converter->umlautToAscii($text);
902  
903 # MEMO: So implementiert man einen speziellen Test
904  
905 0 my $tb = Test::More->builder; # Test::Builder-Objekt besorgen
906 0 $tb->ok($bool,$text); # Testergebnis protokollieren
907 0 ▶ if (!$bool) { # Im Fehlerfall Diagnose protokollieren
Branch: 1 branch
BranchTrueFalseTotal
unless ($bool) 0 0 0
908 0 my @arr = @$expectedA;
909 0 my $last = pop @arr;
910 0 my $expected = join ', ',map {"'$_'"} @arr;
911 0 ▶ if ($expected) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expected) 0 0 0
912 0 $expected .= ' or ';
913 }
914 0 $expected .= "'$last'";
915 # Konform zu Test::Builder krautig formatiert
916 0 $tb->diag(" got: '$got'\n expected: $expected");
917 }
918  
919 0 return $bool; # Testergebnis zurückliefern
920 }
921  
922 0 ▶sub in_orig {
Subroutine in_orig: not called CC=1 SCAR=6.9
Pod undocumented
923 0 my ($self,$got,$expectedA,$text) = @_;
924  
925 0 my $bool = Quiq::Assert->isEnumValue($got,$expectedA);
926  
927 # Um Warnungen à la "does not map to ascii" zu verhindern
928 0 $text = Quiq::Converter->umlautToAscii($text);
929  
930 0 local $Test::Builder::Level = $Test::Builder::Level + 1;
931 0 return Test::More::ok($bool,$text);
932 }
933  
934 {
935 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
936 270 *inTest = \&in;
937 }
938  
939 # -----------------------------------------------------------------------------
940  
941 =head3 is() - Prüfe, ob Wert dem erwarteten Wert entspricht
942  
943 =head4 Synopsis
944  
945 $bool = $test->is($got,$expected);
946 $bool = $test->is($got,$expected,$text);
947  
948 =head4 Alias
949  
950 isTest()
951  
952 =cut
953  
954 # -----------------------------------------------------------------------------
955  
956 1793 ▶sub is {
Subroutine is: called CC=1 SCAR=0.0
Pod documented
957 1793 my ($self,$got,$expected,$text) = @_;
958  
959 # Um Warnungen à la "does not map to ascii" zu verhindern
960 1793 $text = Quiq::Converter->umlautToAscii($text);
961  
962 1793 local $Test::Builder::Level = $Test::Builder::Level + 1;
963 1793 return Test::More::is($got,$expected,$text);
964 }
965  
966 {
967 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
968 270 *isTest = \&is;
969 }
970  
971 # -----------------------------------------------------------------------------
972  
973 =head3 isnt() - Prüfe, ob Wert vom erwarteten Wert abweicht
974  
975 =head4 Synopsis
976  
977 $bool = $test->isnt($got,$expected);
978 $bool = $test->isnt($got,$expected,$text);
979  
980 =head4 Alias
981  
982 isntTest()
983  
984 =cut
985  
986 # -----------------------------------------------------------------------------
987  
988 10 ▶sub isnt {
Subroutine isnt: called CC=1 SCAR=0.0
Pod documented
989 10 my ($self,$got,$expected,$text) = @_;
990  
991 # Um Warnungen à la "does not map to ascii" zu verhindern
992 10 $text = Quiq::Converter->umlautToAscii($text);
993  
994 10 local $Test::Builder::Level = $Test::Builder::Level + 1;
995 10 return Test::More::isnt($got,$expected,$text);
996 }
997  
998 {
999 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1000 270 *isntTest = \&isnt;
1001 }
1002  
1003 # -----------------------------------------------------------------------------
1004  
1005 =head3 isText() - Prüfe, ob Wert dem erwarteten Wert entspricht
1006  
1007 =head4 Synopsis
1008  
1009 $bool = $test->isText($got,$expected);
1010 $bool = $test->isText($got,$expected,$text);
1011  
1012 =head4 Description
1013  
1014 Im Unterschied zur Methode is(), wird auf das Argument $expected
1015 die Methode Quiq::Unindent->trimNl() angewendet. Dies ermöglicht
1016 den einfachen Vergleich im Falle eines mehrzeiligen Textes.
1017  
1018 =cut
1019  
1020 # -----------------------------------------------------------------------------
1021  
1022 18 ▶sub isText {
Subroutine isText: called CC=1 SCAR=0.0
Pod documented
1023 18 my ($self,$got,$expected,$text) = @_;
1024  
1025 # Um Warnungen à la "does not map to ascii" zu verhindern
1026 18 $text = Quiq::Converter->umlautToAscii($text);
1027  
1028 18 local $Test::Builder::Level = $Test::Builder::Level + 1;
1029 18 return Test::More::is($got,Quiq::Unindent->trimNl($expected),$text);
1030 }
1031  
1032 # -----------------------------------------------------------------------------
1033  
1034 =head3 floatIs() - Prüfe, ob Float-Wert dem erwarteten Wert entspricht
1035  
1036 =head4 Synopsis
1037  
1038 $bool = $test->floatIs($got,$expected);
1039 $bool = $test->floatIs($got,$expected,$places);
1040 $bool = $test->floatIs($got,$expected,$places,$text);
1041  
1042 =head4 Description
1043  
1044 Vergleiche die Float-Werte $got und $expected nachdem beide Werte
1045 auf $places Nachkommastellen gerundet wurden. Ist $places nicht
1046 angegeben oder C<undef>, wird die Anzahl der Nachkommastellen
1047 von $expected genommen.
1048  
1049 =cut
1050  
1051 # -----------------------------------------------------------------------------
1052  
1053 51 ▶sub floatIs {
Subroutine floatIs: called CC=3 SCAR=11.0
Pod documented
1054 51 my ($self,$got,$expected,$places,$text) = @_;
1055  
1056 # Um Warnungen à la "does not map to ascii" zu verhindern
1057 51 $text = Quiq::Converter->umlautToAscii($text);
1058  
1059 # Runde auf die Nachkommastellen des erwarteten Werts
1060  
1061 51 ▶ if (!defined $places) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $places) 12 39 51
1062 12 $expected =~ /\.(\d+)/;
1063 12 $places = length($1);
1064 }
1065 51 ▶ if ($places) {
Branch: 1 branch
BranchTrueFalseTotal
if ($places) 51 0 51
1066 51 $got = sprintf '%.*f',$places,$got;
1067 51 $expected = sprintf '%.*f',$places,$expected;
1068 }
1069  
1070 51 local $Test::Builder::Level = $Test::Builder::Level + 1;
1071 51 return Test::More::is($got,$expected,$text);
1072 }
1073  
1074 # -----------------------------------------------------------------------------
1075  
1076 =head3 isClass() - Prüfe, ob Referenz zur erwarteten Klasse gehört
1077  
1078 =head4 Synopsis
1079  
1080 $bool = $test->isClass($ref,$class);
1081 $bool = $test->isClass($ref,$class,$text);
1082  
1083 =head4 Description
1084  
1085 Vergleiche die die Klasse von $ref gegen $class. Der Test ist
1086 erfolgreich, wenn ref($ref) und $class identisch sind.
1087  
1088 =cut
1089  
1090 # -----------------------------------------------------------------------------
1091  
1092 1 ▶sub isClass {
Subroutine isClass: called CC=2 SCAR=7.0
Pod documented
1093 1 my ($self,$ref,$class,$text) = @_;
1094  
1095 1 ▶ $text ||= "Object is a $class";
Condition50%1/2
$text ||= "Object is a $class"
l!l
01
MC/DC0%0/1
$text ||= "Object is a $class"
$text
Truth table50%1/2
A
A= $text
Aresult
11
00
1096  
1097 # Um Warnungen à la "does not map to ascii" zu verhindern
1098 1 $text = Quiq::Converter->umlautToAscii($text);
1099  
1100 1 local $Test::Builder::Level = $Test::Builder::Level + 1;
1101 1 return Test::More::ok($ref->isa($class),$text);
1102 }
1103  
1104 # -----------------------------------------------------------------------------
1105  
1106 =head3 isDeeply() - Prüfe, ob Datenstrukturen identisch sind
1107  
1108 =head4 Synopsis
1109  
1110 $bool = $test->isDeeply($gotRef,$expectedRef);
1111 $bool = $test->isDeeply($gotref,$expectedRef,$text);
1112  
1113 =cut
1114  
1115 # -----------------------------------------------------------------------------
1116  
1117 284 ▶sub isDeeply {
Subroutine isDeeply: called CC=1 SCAR=0.0
Pod documented
1118 284 my ($self,$gotRef,$expectedRef,$text) = @_;
1119  
1120 # Um Warnungen à la "does not map to ascii" zu verhindern
1121 284 $text = Quiq::Converter->umlautToAscii($text);
1122  
1123 284 local $Test::Builder::Level = $Test::Builder::Level + 1;
1124 284 return Test::More::is_deeply($gotRef,$expectedRef,$text);
1125 }
1126  
1127 # -----------------------------------------------------------------------------
1128  
1129 =head3 like() - Prüfe, ob Wert regulären Ausdruck matcht
1130  
1131 =head4 Synopsis
1132  
1133 $bool = $test->like($got,qr/$expected/);
1134 $bool = $test->like($got,qr/$expected/,$text);
1135  
1136 =head4 Alias
1137  
1138 likeTest()
1139  
1140 =cut
1141  
1142 # -----------------------------------------------------------------------------
1143  
1144 240 ▶sub like {
Subroutine like: called CC=1 SCAR=0.0
Pod documented
1145 240 my ($self,$got,$regex,$text) = @_;
1146  
1147 # Um Warnungen à la "does not map to ascii" zu verhindern
1148 240 $text = Quiq::Converter->umlautToAscii($text);
1149  
1150 240 local $Test::Builder::Level = $Test::Builder::Level + 1;
1151 240 return Test::More::like($got,$regex,$text);
1152 }
1153  
1154 {
1155 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1156 270 *likeTest = \&like;
1157 }
1158  
1159 # -----------------------------------------------------------------------------
1160  
1161 =head3 unlike() - Prüfe, ob Wert regulären Ausdruck nicht matcht
1162  
1163 =head4 Synopsis
1164  
1165 $bool = $test->unlike($got,qr/$expected/);
1166 $bool = $test->unlike($got,qr/$expected/,$text);
1167  
1168 =head4 Alias
1169  
1170 unlikeTest()
1171  
1172 =cut
1173  
1174 # -----------------------------------------------------------------------------
1175  
1176 2 ▶sub unlike {
Subroutine unlike: called CC=1 SCAR=0.0
Pod documented
1177 2 my ($self,$got,$regex,$text) = @_;
1178  
1179 # Um Warnungen à la "does not map to ascii" zu verhindern
1180 2 $text = Quiq::Converter->umlautToAscii($text);
1181  
1182 2 local $Test::Builder::Level = $Test::Builder::Level + 1;
1183 2 return Test::More::unlike($got,$regex,$text);
1184 }
1185  
1186 {
1187 270 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
1188 270 *unlikeTest = \&unlike;
1189 }
1190  
1191 # -----------------------------------------------------------------------------
1192  
1193 =head3 cmpOk() - Prüfe, ob Vergleich wahr ist
1194  
1195 =head4 Synopsis
1196  
1197 $bool = $test->cmpOk($this,$op,$that);
1198 $bool = $test->cmpOk($this,$op,$that,$text);
1199  
1200 =head4 Example
1201  
1202 Vergleich auf numerische Verschiedenheit:
1203  
1204 $test->cmpOk($bigNum,'!=',$otherBigNum);
1205  
1206 =cut
1207  
1208 # -----------------------------------------------------------------------------
1209  
1210 3 ▶sub cmpOk {
Subroutine cmpOk: called CC=1 SCAR=0.0
Pod documented
1211 3 my ($self,$this,$op,$that,$text) = @_;
1212  
1213 # Um Warnungen à la "does not map to ascii" zu verhindern
1214 3 $text = Quiq::Converter->umlautToAscii($text);
1215  
1216 3 local $Test::Builder::Level = $Test::Builder::Level + 1;
1217 3 return Test::More::cmp_ok($this,$op,$that,$text);
1218 }
1219  
1220 # -----------------------------------------------------------------------------
1221  
1222 =head2 Ausgabe
1223  
1224 =head3 diag() - Gib Diagnose-Nachricht aus
1225  
1226 =head4 Synopsis
1227  
1228 $bool = $test->diag(@msg);
1229  
1230 =cut
1231  
1232 # -----------------------------------------------------------------------------
1233  
1234 0 ▶sub diag {
Subroutine diag: not called CC=1 SCAR=6.9
Pod documented
1235 0 return shift->[0]->diag(@_);
1236 }
1237  
1238 # -----------------------------------------------------------------------------
1239  
1240 =head2 Private Methoden
1241  
1242 =head3 MODIFY_CODE_ATTRIBUTES() - Callback für Subroutines mit Attributen
1243  
1244 =head4 Synopsis
1245  
1246 @attrib = $class->MODIFY_CODE_ATTRIBUTES($ref,@attrib);
1247  
1248 =head4 Description
1249  
1250 Methode, die von Perl zur Compilezeit für jede Subroutine mit
1251 Attributen gerufen wird.
1252  
1253 Die Methode instantiiert ein Methodenobjekt für jede Testmethode und
1254 speichert sie zur späteren Analyse in der klassenglobalen Liste
1255 @Methods.
1256  
1257 =cut
1258  
1259 # -----------------------------------------------------------------------------
1260  
1261 1045 ▶sub MODIFY_CODE_ATTRIBUTES {
Subroutine MODIFY_CODE_ATTRIBUTES: called CC=7 SCAR=19.5
1262 1045 my $class = shift;
1263 1045 my $ref = shift;
1264  
1265 1045 my ($type,$tests,$group);
1266 1045 for (@_) {
1267 1047 ▶ if (/^(Init|Startup|Setup|Test|Teardown|Shutdown)\((\d+)\)$/) {
Branch: 4 branches
BranchTrueFalseTotal
if (/^(Init|Startup|Setup|Test|Teardown|Shutdown)\((\d+)\)$/) { } 1035 12 1047
elsif (/^Group\((.*?)\)/) { } 2 10 12
elsif (/^(Foreach)$/) { } 3 7 10
elsif (/^Ignore/) { } 7 0 7
1268 1035 $type = $1;
1269 1035 $tests = $2;
1270 }
1271 elsif (/^Group\((.*?)\)/) {
1272 2 $group = $1;
1273 }
1274 elsif (/^(Foreach)$/) {
1275 3 $type = $1;
1276 }
1277 elsif (/^Ignore/) {
1278 7 next;
1279 }
1280 else {
1281 0 $class->throw(
1282 'TEST-00001: Unbekanntes Code-Attribut',
1283 Attribute => $_,
1284 );
1285 }
1286 }
1287 1045 ▶ if ($type) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type) 1038 7 1045
1288 1038 push @Methods,Quiq::Test::Class::Method->new(
1289 $class,$ref,$type,$tests,$group);
1290 }
1291  
1292 1045 return;
1293 }
1294  
1295 # -----------------------------------------------------------------------------
1296  
1297 =head1 VERSION
1298  
1299 1.240
1300  
1301 =head1 AUTHOR
1302  
1303 Frank Seitz, L<http://fseitz.de/>
1304  
1305 =head1 COPYRIGHT
1306  
1307 Copyright (C) 2026 Frank Seitz
1308  
1309 =head1 LICENSE
1310  
1311 This code is free software; you can redistribute it and/or modify
1312 it under the same terms as Perl itself.
1313  
1314 =cut
1315  
1316 # -----------------------------------------------------------------------------
1317  
1318 270 1;
1319  
1320 # eof
« Quiq/Url.pm ↑ Summary Quiq/Axis.pm »