-
Notifications
You must be signed in to change notification settings - Fork 6
/
wi.t
1853 lines (1604 loc) · 74.4 KB
/
wi.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env perl
use diagnostics;
use warnings;
use strict;
use Test::More qw( no_plan );
use File::Path qw(make_path remove_tree);
use vars qw/ $VERSION /;
$VERSION = '0.0.1';
#http://www.drdobbs.com/scripts-as-modules/184416165
do './wi.pl';
require HTTP::Cookies;
require LWP;
my $WEBIMBLAZE_ROOT = $main::this_script_folder_full;
$WEBIMBLAZE_ROOT =~ s{\\}{/}g;
my $OUTPUT = 'unittest/';
remove_tree($WEBIMBLAZE_ROOT . $OUTPUT);
#
# GLOBAL TEST SETUP
#
before_test();
#
#
# get_testnum_display
#
#
is(get_testnum_display(5,1), '5', 'get_testnum_display: Standard');
is(get_testnum_display(5,2), '10005', 'get_testnum_display: 1st repeat');
is(get_testnum_display(5,3), '20005', 'get_testnum_display: 2nd repeat');
$main::case{runon}='PROD';
is(get_test_step_skip_message(), 'run on PROD', 'get_test_step_skip_message: run on PROD');
$main::case{runon}='PAT';
is(get_test_step_skip_message(), 'run on PAT', 'get_test_step_skip_message: run on PAT');
#
#
# _url_path
#
#
is(_url_path('https://example.com/search/form?terms=cheapest'), '/search/form', '_url_path: Full url with query string');
#
#
# save_page_when_method_post_and_has_action
#
#
before_test();
$main::resp_content = ('A response without an action');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('ACTION none', 'save_page_when_method_post_and_has_action : ACTION none');
before_test();
$main::resp_content = ('A response with an action after post - method="post" id="3" action="submit.aspx"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('ACTION submit.aspx', 'save_page_when_method_post_and_has_action : ACTION after method of post');
before_test();
$main::resp_content = ('A response with an action before post - action="submit.aspx" id="3" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('ACTION submit.aspx', 'save_page_when_method_post_and_has_action : ACTION before method of post');
before_test();
$main::resp_content = ('A response with a null action - action="" id="3" method="post"');
save_page_when_method_post_and_has_action ();
is(stdout_contains('ACTION IS NULL'), 1, 'save_page_when_method_post_and_has_action : ACTION IS NULL');
assert_stdout_contains('SAVING /jobs/search.cgi', 'save_page_when_method_post_and_has_action : default action to page path');
before_test();
$main::resp_content = ('A response with full url in action="https://example.com/home/query.cgi?keyword=test" method="post"');
save_page_when_method_post_and_has_action ();
is(stdout_contains('ACTION https:'), 1, 'save_page_when_method_post_and_has_action : full url in action');
assert_stdout_contains('SAVING /home/query.cgi', 'save_page_when_method_post_and_has_action : clean action to just url path');
before_test();
$main::resp_content = ('action="submit.aspx" id="3" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('NO CACHED PAGES', 'save_page_when_method_post_and_has_action : NO CACHED PAGES');
before_test();
$main::resp_content = ('action="submit.aspx" id="3" method="post"');
save_page_when_method_post_and_has_action ();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('MATCH at position 0', 'save_page_when_method_post_and_has_action : MATCH at position 0');
before_test();
$main::resp_content = ('action="submit.aspx" id="3" method="post"');
save_page_when_method_post_and_has_action ();
$main::resp_content = ('action="query.aspx" id="3" method="post"');
save_page_when_method_post_and_has_action ();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('MATCH at position 1', 'save_page_when_method_post_and_has_action : MATCH at position 1');
before_test();
$main::resp_content = ('action="submit.aspx" method="post"');
save_page_when_method_post_and_has_action ();
$main::resp_content = ('action="query.aspx" method="post"');
save_page_when_method_post_and_has_action ();
$main::resp_content = ('action="/register.cgi" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('NO MATCH on 0:submit.aspx', 'save_page_when_method_post_and_has_action : NO MATCH on 0:submit.aspx');
assert_stdout_contains('NO MATCH on 1:query.aspx', 'save_page_when_method_post_and_has_action : NO MATCH on 1:query.aspx');
assert_stdout_contains('NO MATCHES FOUND IN CACHE', 'save_page_when_method_post_and_has_action : NO MATCHES FOUND IN CACHE - different action');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('MATCH at position 2', 'save_page_when_method_post_and_has_action : MATCH at position 2');
$main::resp_content = ('action="/submit.aspx" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('NO MATCHES FOUND IN CACHE', 'save_page_when_method_post_and_has_action : NO MATCHES FOUND IN CACHE - slightly different action');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('MATCH at position 3', 'save_page_when_method_post_and_has_action : MATCH at position 3 - slightly different action saved again');
before_test();
$main::resp_content = ('action="index_0" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Index 0 is free', 'save_page_when_method_post_and_has_action : Index 0 is free');
$main::resp_content = ('action="index_1" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Index 1 is free', 'save_page_when_method_post_and_has_action : Index 1 is free');
$main::resp_content = ('action="index_2" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Index 2 is free', 'save_page_when_method_post_and_has_action : Index 2 is free');
$main::resp_content = ('action="index_3" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Index 3 is free', 'save_page_when_method_post_and_has_action : Index 3 is free');
$main::resp_content = ('action="index_4" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Index 4 is free', 'save_page_when_method_post_and_has_action : Index 4 is free');
$main::resp_content = ('action="index_5" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Index 5 is free', 'save_page_when_method_post_and_has_action : Index 5 is free');
$main::resp_content = ('action="page_7" method="post"');
clear_stdout();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Overwriting - Oldest Page Index: 0', 'save_page_when_method_post_and_has_action : Overwrite oldest page in cache - index 0');
$main::resp_content = ('action="page_8" method="post"');
clear_stdout();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Overwriting - Oldest Page Index: 1', 'save_page_when_method_post_and_has_action : Overwrite oldest page in cache - index 1');
$main::resp_content = ('action="page_9" method="post"');
clear_stdout();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Overwriting - Oldest Page Index: 2', 'save_page_when_method_post_and_has_action : Overwrite oldest page in cache - index 2');
clear_stdout();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('MATCH at position 2', 'save_page_when_method_post_and_has_action : MATCH at position 2 - save overwritten page again');
$main::resp_content = ('action="page_8" method="post"');
clear_stdout();
save_page_when_method_post_and_has_action ();
assert_stdout_contains('MATCH at position 1', 'save_page_when_method_post_and_has_action : MATCH at position 1 - save older overwritten page again');
assert_stdout_contains('Cache 0:page_7', 'save_page_when_method_post_and_has_action : saved in cache at 0');
assert_stdout_contains('Cache 1:page_8', 'save_page_when_method_post_and_has_action : saved in cache at 1');
assert_stdout_contains('Cache 2:page_9', 'save_page_when_method_post_and_has_action : saved in cache at 2');
assert_stdout_contains('Cache 3:index_3', 'save_page_when_method_post_and_has_action : saved in cache at 3');
assert_stdout_contains('Cache 4:index_4', 'save_page_when_method_post_and_has_action : saved in cache at 4');
assert_stdout_contains('Cache 5:index_5', 'save_page_when_method_post_and_has_action : saved in cache at 5');
before_test();
$main::resp_content = ('action="submit.aspx" method="post"');
save_page_when_method_post_and_has_action ();
assert_stdout_contains('Saved [\d\.]+:submit.aspx', 'save_page_when_method_post_and_has_action : confirmation page is saved');
#
#
# auto_sub
#
#
before_test();
auto_sub('a=b&c=d&e=f', 'normalpost', 'http://example.com');
assert_stdout_contains('There are 3 fields in the postbody', 'auto_sub : normal post has 3 fields');
before_test();
auto_sub(q{}, 'normalpost', 'http://example.com');
assert_stdout_contains('There are 0 fields in the postbody', 'auto_sub : normal post has 0 fields');
before_test();
auto_sub('a=b', 'normalpost', 'http://example.com');
assert_stdout_contains('There are 1 fields in the postbody', 'auto_sub : normal post has 1 field');
before_test();
auto_sub(q{( 'name' => 'Upload' )}, 'multipost', 'http://example.com');
assert_stdout_contains('There are 1 fields in the postbody', 'auto_sub : multi post has 1 field');
before_test();
auto_sub(q{( 'fileUpload' => ['examples/multipart_post.csv'], 'name' => 'Upload' )}, 'multipost', 'http://example.com');
assert_stdout_contains('There are 1 fields in the postbody', 'auto_sub : multi post has 2 fields');
before_test();
auto_sub('a=b&c=d&e=f', 'normalpost', 'http://example.com');
assert_stdout_contains('Field 1: a=b', 'auto_sub : field 1 display');
assert_stdout_contains('Field 2: c=d', 'auto_sub : field 2 display');
assert_stdout_contains('Field 3: e=f', 'auto_sub : field 3 display');
before_test();
auto_sub(q{( 'a' => 'b', 'c' => 'd', 'e' => 'f' )}, 'multipost', 'http://example.com');
assert_stdout_contains(q|Field 1: \( 'a' => 'b|, 'auto_sub : multipost field 1 display');
assert_stdout_contains(q|Field 2: 'c' => 'd|, 'auto_sub : multimpost field 2 display');
assert_stdout_contains(q|Field 3: 'e' => 'f|, 'auto_sub : multimpost field 3 display'); #'
before_test();
is(auto_sub('a=b&c=d&e=f', 'normalpost', 'http://example.com'), 'a=b&c=d&e=f', 'auto_sub : no change - no cached pages');
assert_stdout_contains('REMOVE PATH', 'auto_sub : remove path');
assert_stdout_contains('DESPERATE MODE - NO ANCHOR', 'auto_sub : desperate mode - no anchor');
before_test();
$main::resp_content = ('action="/search.aspx" method="post"');
save_page_when_method_post_and_has_action ();
auto_sub('a=b&c=d&e=f', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('MATCH at position 0', 'auto_sub : exact action match - assert 1');
assert_stdout_does_not_contain('PAGE NAME ONLY', 'auto_sub : exact action match - assert 2');
before_test();
$main::resp_content = ('action="/search.aspx" method="post"');
save_page_when_method_post_and_has_action ();
auto_sub('a=b&c=d&e=f', 'normalpost', 'http://example.com/premium/search.aspx');
assert_stdout_contains('MATCH at position 0', 'auto_sub : page name only - assert 2');
assert_stdout_contains('REMOVE PATH', 'auto_sub : page name only - assert 2');
assert_stdout_does_not_contain('DESPERATE MODE', 'auto_sub : page name only - assert 3');
before_test();
$main::resp_content = ('action="/search.aspx" method="post"');
save_page_when_method_post_and_has_action ();
auto_sub('a=b&c=d&e=f', 'normalpost', 'http://example.com/premium/search');
assert_stdout_contains('MATCH at position 0', 'auto_sub : desperate mode - assert 2');
assert_stdout_contains('DESPERATE MODE', 'auto_sub : desperate mode - assert 2');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" name="a" type="hidden" value="bee bee"');
save_page_when_method_post_and_has_action ();
auto_sub('a={DATA}&c=d&e=f', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('ID MATCH 0', 'auto_sub : ID MATCH');
assert_stdout_contains('Normal field a has \{DATA\}', 'auto_sub : normal field has {DATA}');
assert_stdout_contains('DATA is bee', 'auto_sub : normalpost {DATA} - field 1 - assert 1');
assert_stdout_contains('URLESCAPE!!', 'auto_sub : normalpost {DATA} - field 1 - assert 2');
assert_stdout_contains('SUBBED FIELD is a=bee%20bee', 'auto_sub : normalpost {DATA} - field 1 - assert 3');
assert_stdout_contains('a=bee%20bee', 'auto_sub : normalpost {DATA} - field 1 - assert 4');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" <input name="c" value="dee" /> <input name="e" value="eff" />');
save_page_when_method_post_and_has_action ();
auto_sub('a=b&c={DATA}&e={DATA}', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('c=dee', 'auto_sub : normalpost {DATA} - field 2');
assert_stdout_contains('e=eff', 'auto_sub : normalpost {DATA} - field 3');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" name="a" type="hidden" value="bee bee"');
save_page_when_method_post_and_has_action ();
auto_sub(q{( 'a' => '{DATA}', 'c' => 'd', 'e' => 'f' )}, 'multipost', 'http://example.com/search.aspx');
assert_stdout_contains('ID MATCH 0', 'auto_sub : ID MATCH');
assert_stdout_contains('Multi field a has \{DATA\}', 'auto_sub : multi field has {DATA}');
assert_stdout_contains('DATA is bee', 'auto_sub : multipost {DATA} - field 1 - assert 1');
assert_stdout_contains(q|SUBBED FIELD is \( 'a' => 'bee bee|, 'auto_sub : multipost {DATA} - field 1 - assert 2'); #'
assert_stdout_contains(q|POSTBODY is \( 'a' => 'bee bee', 'c' => 'd', 'e' => 'f' \)|, 'auto_sub : multipost {DATA} - field 1 - assert 3');
assert_stdout_contains('Auto substitution latency was ', 'auto_sub : latency display');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" <input name="c" value="dee" /> <input name="e" value="eff" />');
save_page_when_method_post_and_has_action ();
auto_sub(q|( 'a' => 'b', 'c' => '{DATA}', 'e' => '{DATA}' )|, 'multipost', 'http://example.com/search.aspx');
assert_stdout_contains(q|'c' => 'dee'|, 'auto_sub : multipost {DATA} - field 2');
assert_stdout_contains(q|'e' => 'eff'|, 'auto_sub : multipost {DATA} - field 3');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" name="Row1_Col1_Field1" type="hidden" value="b"');
save_page_when_method_post_and_has_action ();
auto_sub('Row1_{NAME}_Field1=b&c=d&e=f', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('LHS of \{NAME}: \[Row1_] ', 'auto_sub : normal post - LHS of {NAME}');
assert_stdout_contains('RHS of \{NAME}: \[_Field1] ', 'auto_sub : normal post - RHS of {NAME}');
assert_stdout_contains('NAME is Col1', 'auto_sub : normal post - NAME is');
assert_stdout_contains('SUBBED NAME is Row1_Col1_Field1=b', 'auto_sub : normal post - SUBBED NAME is');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" <input name="Row2_Col2_Field2" value="d" /> <input name="Row3_Col3_Field3" value="f" /> ');
save_page_when_method_post_and_has_action ();
auto_sub('Row1_Col1_Field1=b&Row2_{NAME}_Field2=d&Row3_{NAME}_Field3=f', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('NAME is Col2', 'auto_sub : normal post - NAME is - field 2');
assert_stdout_contains('NAME is Col3', 'auto_sub : normal post - NAME is - field 2');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" name="Row1_Col1_Field1" type="hidden" value="b"');
save_page_when_method_post_and_has_action ();
auto_sub('{NAME}_Field1=b&c=d&e=f', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('LHS of \{NAME}: \[] ', 'auto_sub : LHS of {NAME} is null');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" name="Row1_Col1_Field1" type="hidden" value="b"');
save_page_when_method_post_and_has_action ();
auto_sub('Row1_Col1_{NAME}=b&c=d&e=f', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('RHS of \{NAME}: \[] ', 'auto_sub : RHS of {NAME} is null');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" <input name="Row2_Col2_Field2" value="d" /> <input name="Row3_Col3_Field3" value="f" /> ');
save_page_when_method_post_and_has_action ();
auto_sub(q|( 'a' => 'b', 'Row2_{NAME}_Field2' => '{DATA}', '{NAME}Field3' => '{DATA}' )|, 'multipost', 'http://example.com/search.aspx');
assert_stdout_contains(q|POSTBODY is \( 'a' => 'b', 'Row2_Col2_Field2' => 'd', 'Row3_Col3_Field3' => 'f' \)|, 'auto_sub : multi post - NAME and DATA');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" <input name="strange_xname" value="d" /> <input name="odd_yname" value="f" /> ');
save_page_when_method_post_and_has_action ();
auto_sub(q|( 'a' => 'b', '{NAME}_xname.x' => '{DATA}', '{NAME}_yname.y' => '{DATA}' )|, 'multipost', 'http://example.com/search.aspx');
assert_stdout_contains('DOTx found in ', 'auto_sub : NAME - DOTX');
assert_stdout_contains('DOTy found in ', 'auto_sub : NAME - DOTY');
assert_stdout_contains(q|DOTx restored to 'strange_xname.x'|, 'auto_sub : NAME - DOTX restored');
assert_stdout_contains(q|DOTy restored to 'odd_yname.y'|, 'auto_sub : NAME - DOTY restored');
assert_stdout_contains(q|POSTBODY is \( 'a' => 'b', 'strange_xname.x' => 'd', 'odd_yname.y' => 'f' \)|, 'auto_sub : DOTX and DOTY');
before_test();
$main::resp_content = ('action="/search.aspx" method="post" <input name="odd_xname" value="default" /> <input name="odd_yname" value="default" /> ');
save_page_when_method_post_and_has_action ();
auto_sub('a=b&{NAME}xname.x=d.xtra&{NAME}yname.y=f.ytra', 'normalpost', 'http://example.com/search.aspx');
assert_stdout_contains('odd_xname\.x=d\.xtra', 'auto_sub : DOTX - ensure value not affected');
assert_stdout_contains('odd_yname\.y=f\.ytra', 'auto_sub : DOTY - ensure value not affected');
#
#
# Lean Test Format
#
#
# XMLin function creates a data structure like the below, the lean parse must produce the same structure
#
#$VAR1 = {
# 'case' => {
# '20' => {
# 'step' => 'Another step - retry {RETRY}',
# 'desc' => 'Sub description',
# 'method' => 'shell',
# 'shell' => 'REM Not much more - retry {RETRY}',
# 'retry' => '3',
# 'verifynegative' => 'Nothing much',
# 'verifypositive' => 'retry 1'
# },
# '10' => {
# 'step' => 'Test that WebImblaze can run a very basic test',
# 'shell' => 'REM Nothing: much',
# 'method' => 'shell',
# 'verifypositive1' => 'Nothing: much'
# }
# },
# 'repeat' => '1'
# };
before_test();
$main::unit_test_steps = <<'EOB'
step: Test that WebImblaze can run a very basic test
shell: REM Nothing: much
verifypositive1: Nothing: much
step: Another step - retry {RETRY}
desc: Sub description
shell: REM Not much more - retry {RETRY}
verifypositive: retry 1
verifynegative: Nothing much
retry: 3
EOB
;
read_test_steps_file();
assert_stdout_contains('Lean test steps parsed OK', 'read_test_steps_file : lean style format parsed ok');
assert_stdout_does_not_contain(q{'repeat' => '1'}, '_parse_lean_test_steps : repeat is not defaulted');
assert_stdout_contains(q{'10' =>}, '_parse_lean_test_steps : Step 10 found');
assert_stdout_contains(q{'step' => 'Test that WebImblaze can run a very basic test'}, '_parse_lean_test_steps : Step 10, step name found');
assert_stdout_contains(q{'shell' => 'REM Nothing: much'}, '_parse_lean_test_steps : Step 10, command found');
assert_stdout_contains(q{'verifypositive1' => 'Nothing: much'}, '_parse_lean_test_steps : Step 10, verifypositive1 found');
assert_stdout_contains(q{'20' =>}, '_parse_lean_test_steps : Step 20 found');
assert_stdout_contains(q{'step' => 'Another step - retry [{]RETRY}'}, '_parse_lean_test_steps : Step 20, desc1 found');
assert_stdout_contains(q{'desc' => 'Sub description'}, '_parse_lean_test_steps : Step 20, desc2 found');
assert_stdout_contains(q{'method' => 'shell'}, '_parse_lean_test_steps : Step 20, method found');
assert_stdout_contains(q{'shell' => 'REM Not much more - retry [{]RETRY}'}, '_parse_lean_test_steps : Step 20, command found');
assert_stdout_contains(q{'retry' => '3'}, '_parse_lean_test_steps : Step 20, retry found');
assert_stdout_contains(q{'verifynegative' => 'Nothing much'}, '_parse_lean_test_steps : Step 20, verifynegative found');
assert_stdout_contains(q{'verifypositive' => 'retry 1'}, '_parse_lean_test_steps : Step 20, verifypositive found');
# can have a lean test case file with a single step
before_test();
$main::unit_test_steps = <<'EOB'
step: Single test step in file
shell: echo Short
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'10' =>}, '_parse_lean_test_steps : Can have just one test step');
# can have quotes
before_test();
$main::unit_test_steps = <<'EOB'
step: Can handle 'single' and "double" quotes
shell: echo 'single' and "double" quotes
verifypostive: 'single' and "double" quotes
EOB
;
read_test_steps_file();
assert_stdout_contains('Lean test steps parsed OK', '_parse_lean_test_steps : Can handle single and double quotes');
# id auto generated - cannot be specified
before_test();
$main::unit_test_steps = <<'EOB'
step: Id is auto generated
shell: echo auto
step: Next step
shell: echo next
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'10' =>}, '_parse_lean_test_steps : step ids are auto generated - 10');
assert_stdout_contains(q{'20' =>}, '_parse_lean_test_steps : step ids are auto generated - 20');
# method="cmd" is auto generated
before_test();
$main::unit_test_steps = <<'EOB'
step: Shell method is detected
shell: echo auto1
shell20: echo auto2
step: Next step
shell5: echo next1
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'shell20' => 'echo auto2'}, '_parse_lean_test_steps : shell not converted back to command');
assert_stdout_contains(q{'method' => 'shell'}, '_parse_lean_test_steps : shell method detected - 1');
# method="cmd" is auto generated - shell1
before_test();
$main::unit_test_steps = <<'EOB'
step: Shell method is detected
shell1: echo auto1
step: Next step
shell1: echo next1
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'method' => 'shell'}, '_parse_lean_test_steps : shell method detected - 2');
# method="selenium" is auto generated
before_test();
$main::unit_test_steps = <<'EOB'
step: Selenium method is detected
selenium3: $driver->get("https://www.totaljobs.com")
selenium20: $driver->get_all_cookies()
step: Next step
selenium5: $driver->get('https://www.totaljobs.com/register')
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'method' => 'selenium'}, '_parse_lean_test_steps : Selenium method detected');
assert_stdout_contains(q{'selenium20' => '.driver->get_all_cookies..'}, '_parse_lean_test_steps : selenium not converted back to command');
# method="get" is auto generated
before_test();
$main::unit_test_steps = <<'EOB'
step: Get method is detected
url: https://www.totaljobs.com
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'method' => 'get'}, '_parse_lean_test_steps : get method detected');
# method="post" is auto generated
before_test();
$main::unit_test_steps = <<'EOB'
step: Get method is detected
url: https://www.totaljobs.com
postbody: RecipeName=Sheperds%20Pie&Cuisine=British
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'method' => 'post'}, '_parse_lean_test_steps : post method detected');
# single line comment is a hash
before_test();
$main::unit_test_steps = <<'EOB'
step: Single line comment
url: https://www.totaljobs.com
#verifypositive: positive
EOB
;
read_test_steps_file();
assert_stdout_does_not_contain(q{'verifypositive'}, '_parse_lean_test_steps : single line comment first char');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : single line comment does not generate null parameter');
# multi line comment starts with --= and ends with =--
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line comment
url: https://www.totaljobs.com
#verifypositive: positive
--=
step: This step is commented out
url: https://www.totaljobs.com
verifypositive: Not found
=--
EOB
;
read_test_steps_file();
assert_stdout_does_not_contain(q{'Not found'}, '_parse_lean_test_steps : multi line comment');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : multi line comment does not generate null parameter');
# multi line comment can exist in a test step
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line comment
url: https://www.totaljobs.com
verifypositive: sure
--=
verifypositive: positive
=--
verifynegative: negative
EOB
;
read_test_steps_file();
assert_stdout_does_not_contain(q{'verifypositive' => 'positive'}, '_parse_lean_test_steps : can have multi line comment in step');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : multi line comment in step does not generate null parameter');
assert_stdout_contains(q{'verifynegative' => 'negative'}, '_parse_lean_test_steps : can have multi line comment in step - parm after comment is active');
# multi line comment and single line comment beside each other
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line comment
url: https://www.totaljobs.com
verifypositive: sure
#boring
--=
verifypositive: positive
=--
#verifypositive: happy
verifynegative: negative
#verifypositive: sad
EOB
;
read_test_steps_file();
assert_stdout_does_not_contain(q{'verifypositive' => 'positive'}, '_parse_lean_test_steps : multi comment ignore in mixed comments');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : multi line and single line comment does not generate null parameter');
assert_stdout_contains(q{'verifynegative' => 'negative'}, '_parse_lean_test_steps : multi and single line comments mixed ok - 1');
assert_stdout_contains(q{'verifypositive' => 'sure'}, '_parse_lean_test_steps : multi and single line comments mixed ok - 2');
assert_stdout_does_not_contain(q{'20' =>}, '_parse_lean_test_steps : multi line and single line comment - should only be one step');
# multi line comment can end anywhere on line
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line comment can end anywhere
url: https://www.totaljobs.com
verifypositive: sure
--=
verifypositive: positive =--
verifynegative: negative
EOB
;
read_test_steps_file();
assert_stdout_does_not_contain(q{'verifypositive' => 'positive'}, '_parse_lean_test_steps : multi comment can end anywhere on line - 1');
assert_stdout_contains(q{'verifynegative' => 'negative'}, '_parse_lean_test_steps : multi comment can end anywhere on line - 2');
# not a multi line comment - should not be removed
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line comment
url: https://www.totaljobs.com
verifypositive1: sure --= thing
verifypositive2: positive
verifynegative1: negative =--
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => 'sure --= thing'}, '_parse_lean_test_steps : not a multiline quote - 1');
assert_stdout_contains(q{'verifypositive2' => 'positive'}, '_parse_lean_test_steps : not a multiline quote - 2');
assert_stdout_contains(q{'verifynegative1' => .negative =--}, '_parse_lean_test_steps : not a multiline quote - 3');
# quoted string - one line
before_test();
$main::unit_test_steps = <<'EOB'
step: One line quoted string
url: https://www.totaljobs.com
verifypositive:q: q sure q
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive' => ' sure '}, '_parse_lean_test_steps : single line quote - single char');
# quoted string - one line special characters
before_test();
$main::unit_test_steps = <<'EOB'
step: Be sure of one line quoted string
url: https://www.totaljobs.com
verifypositive1:$: $ sure $
verifypositive2:^: ^ sure ^
verifypositive3:.: . sure .
verifypositive4:*: * sure *
verifypositive5:+: + sure +
verifypositive6:?: ? sure ?
verifypositive7:\: \ sure \
verifypositive8:|: | sure |
verifypositive9:-: - sure -
verifypositiveA:/: / sure /
verifypositiveB:#: # sure #
verifypositiveC:@: @ sure @
verifypositiveD:&: & sure &
verifypositiveE:=: = sure =
verifypositiveF:": " sure "
verifypositiveG:': ' sure '
verifypositiveH:`: ` sure `
verifypositiveI:0: 0 sure 0
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => ' sure '}, '_parse_lean_test_steps : single line quote - single char $');
assert_stdout_contains(q{'verifypositive2' => ' sure '}, '_parse_lean_test_steps : single line quote - single char ^');
assert_stdout_contains(q{'verifypositive3' => ' sure '}, '_parse_lean_test_steps : single line quote - single char .');
assert_stdout_contains(q{'verifypositive4' => ' sure '}, '_parse_lean_test_steps : single line quote - single char *');
assert_stdout_contains(q{'verifypositive5' => ' sure '}, '_parse_lean_test_steps : single line quote - single char +');
assert_stdout_contains(q{'verifypositive6' => ' sure '}, '_parse_lean_test_steps : single line quote - single char ?');
assert_stdout_contains(q{'verifypositive7' => ' sure '}, '_parse_lean_test_steps : single line quote - single char \\');
assert_stdout_contains(q{'verifypositive8' => ' sure '}, '_parse_lean_test_steps : single line quote - single char |');
assert_stdout_contains(q{'verifypositive9' => ' sure '}, '_parse_lean_test_steps : single line quote - single char -');
assert_stdout_contains(q{'verifypositiveA' => ' sure '}, '_parse_lean_test_steps : single line quote - single char /');
assert_stdout_contains(q{'verifypositiveB' => ' sure '}, '_parse_lean_test_steps : single line quote - single char #');
assert_stdout_contains(q{'verifypositiveC' => ' sure '}, '_parse_lean_test_steps : single line quote - single char @');
assert_stdout_contains(q{'verifypositiveD' => ' sure '}, '_parse_lean_test_steps : single line quote - single char &');
assert_stdout_contains(q{'verifypositiveE' => ' sure '}, '_parse_lean_test_steps : single line quote - single char =');
assert_stdout_contains(q{'verifypositiveF' => ' sure '}, '_parse_lean_test_steps : single line quote - single char "');
assert_stdout_contains(q{'verifypositiveG' => ' sure '}, q{_parse_lean_test_steps : single line quote - single char '});
assert_stdout_contains(q{'verifypositiveH' => ' sure '}, '_parse_lean_test_steps : single line quote - single char `');
assert_stdout_contains(q{'verifypositiveI' => ' sure '}, '_parse_lean_test_steps : single line quote - single char 0');
# quoted string - empty string quote
before_test();
$main::unit_test_steps = <<'EOB'
step: Empty string quote
url: https://www.totaljobs.com
verifypositive1:_: __
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => ''}, '_parse_lean_test_steps : empty string quote - single char _');
# quoted string - quote char is colon
before_test();
$main::unit_test_steps = <<'EOB'
step: Empty string quote
url: https://www.totaljobs.com
verifypositive1:;: ;hey;
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => 'hey'}, '_parse_lean_test_steps : quote character is semicolon ');
# unquoted string - preceding and trailing spaces ignored
before_test();
$main::unit_test_steps = <<'EOB'
step: Empty string quote
url: https://www.totaljobs.com
verifypositive1: hello
verifypositive2: world
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => 'hello'}, '_parse_lean_test_steps : before and after spaces ignored for unquoted string - 1');
assert_stdout_contains(q{'verifypositive2' => 'world'}, '_parse_lean_test_steps : before and after spaces ignored for unquoted string - 2');
# multi char single line quotes
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi char single line quotes
url: https://www.totaljobs.com
verifypositive1:qqq: qqq hello qqq
verifypositive2:--=: --= hello --=
verifypositive3:=--: =-- hello =--
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => ' hello '}, '_parse_lean_test_steps : multi char single line quotes - 1');
assert_stdout_contains(q{'verifypositive2' => ' hello '}, '_parse_lean_test_steps : multi char single line quotes - 2');
assert_stdout_contains(q{'verifypositive3' => ' hello '}, '_parse_lean_test_steps : multi char single line quotes - 3');
# mirrored chars for quote
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi char single line quotes
url: https://www.totaljobs.com
verifypositive1:(: ( hello )
verifypositive2:{{: {{ hello }}
verifypositive3:[<: [< hello ]>
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => ' hello '}, '_parse_lean_test_steps : mirror char for quotes - ()');
assert_stdout_contains(q{'verifypositive2' => ' hello '}, '_parse_lean_test_steps : mirror char for quotes - {{}}');
assert_stdout_contains(q{'verifypositive3' => ' hello '}, '_parse_lean_test_steps : mirror char for quotes [<]>');
# multiline quotes - classic
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line value
url: https://www.totaljobs.com
postbody:|: | first line
second line
third line|
verifypositive1: first
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => 'first'}, '_parse_lean_test_steps : multi line value - 1');
assert_stdout_contains(q{'postbody' => ' first line }, '_parse_lean_test_steps : multi line value - 2');
assert_stdout_contains(q{'postbody' => [^|]+second line}, '_parse_lean_test_steps : multi line value - 3');
assert_stdout_contains(q{'postbody' => [^|]+third line'}, '_parse_lean_test_steps : multi line value - 4');
assert_stdout_does_not_contain(q{LOGIC ERROR}, '_parse_lean_test_steps : multi line value - 5');
# multiline quotes - minimum
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line min value
url: https://www.totaljobs.com
postbody:|: | first line
second line|
verifypositive1: first
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive1' => 'first'}, '_parse_lean_test_steps : multi line min value - 1');
assert_stdout_does_not_contain(q{LOGIC ERROR}, '_parse_lean_test_steps : multi line min value - 2');
assert_stdout_contains(q{'postbody' => ' first line }, '_parse_lean_test_steps : multi line min value - 3');
assert_stdout_contains(q{'postbody' => [^|]+second line'}, '_parse_lean_test_steps : multi line min value - 4');
# multi scenarios
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi 10
url: https://www.totaljobs.com
postbody:QUOTE: QUOTE first line
second lineQUOTE
--= Various: value
=--
#ignore: this
step: Multi 20
url: https://www.cwjobs.co.uk
postbody:[[[: [[[
first content line
second content line
]]]
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'step' => 'Multi 10'}, '_parse_lean_test_steps : multi scenarios - 1');
assert_stdout_contains(q{'url' => 'https://www.totaljobs.com'}, '_parse_lean_test_steps : multi scenarios - 2');
assert_stdout_contains(q{'postbody' => ' first line }, '_parse_lean_test_steps : multi scenarios - 3');
assert_stdout_contains(q{second line'}, '_parse_lean_test_steps : multi scenarios - 4');
assert_stdout_does_not_contain(q{'30' =>}, '_parse_lean_test_steps : multi scenarios - 5');
assert_stdout_does_not_contain(q{LOGIC ERROR}, '_parse_lean_test_steps : multi scenarios - 6');
assert_stdout_does_not_contain(q{'ignore' => 'this'}, '_parse_lean_test_steps : multi scenarios - 7');
assert_stdout_contains(q{'step' => 'Multi 20'}, '_parse_lean_test_steps : multi scenarios - 8');
assert_stdout_contains(q{'url' => 'https://www.cwjobs.co.uk'}, '_parse_lean_test_steps : multi scenarios - 9');
assert_stdout_contains('first content line ', '_parse_lean_test_steps : multi scenarios - 10');
assert_stdout_contains(' second content line', '_parse_lean_test_steps : multi scenarios - 11');
# multiple blank lines between steps
before_test();
$main::unit_test_steps = <<'EOB'
step: Multiple blank lines between steps
url: https://www.totaljobs.com
step: Step 2
url: https://www.cwjobs.co.uk
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'url' => 'https://www.totaljobs.com'}, '_parse_lean_test_steps : blank lines between steps - 1');
assert_stdout_contains(q{'step' => 'Multiple blank lines between steps'}, '_parse_lean_test_steps : blank lines between steps - 2');
assert_stdout_contains(q{'url' => 'https://www.cwjobs.co.uk'}, '_parse_lean_test_steps : blank lines between steps - 3');
assert_stdout_contains(q{'step' => 'Step 2'}, '_parse_lean_test_steps : blank lines between steps - 4');
assert_stdout_does_not_contain(q{'30' =>}, '_parse_lean_test_steps : blank lines between steps - 5');
# single line comment within quote
before_test();
$main::unit_test_steps = <<'EOB'
# assertcount: 5
step: Single line comment within quote
shell: echo NOP
verifypositive:[[: [[
# not a comment
# more content]]
verifynegative: bad stuff
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifynegative' => 'bad stuff'}, '_parse_lean_test_steps : single line comment in quote - 1');
assert_stdout_does_not_contain(q{'20' =>}, '_parse_lean_test_steps : single line comment in quote - 2');
assert_stdout_contains(q{'verifypositive' => '}, '_parse_lean_test_steps : single line comment in quote - 3');
assert_stdout_does_not_contain(q{'assert_count' =>}, '_parse_lean_test_steps : single line comment in quote - 4');
# single line comment not in quote
before_test();
$main::unit_test_steps = <<'EOB'
# assertcount: 5
step: Single line comment not in quote
shell: echo NOP
verifypositive:[[: [[
# more content]]
verifynegative: bad stuff
EOB
;
read_test_steps_file();
assert_stdout_contains(q{Got a single line comment index 0}, '_parse_lean_test_steps : single line comment not in quote - 1');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : single line comment not in quote - 2');
# various single line comments
before_test();
$main::unit_test_steps = <<'EOB'
# assertcount: 5
# step: 1
# step: 2
#pre: comment
step: Single line comment not in quote
shell: echo NOP
verifypositive:[[: [[
# more content]]
verifynegative: bad stuff
# comment: 3
EOB
;
read_test_steps_file();
assert_stdout_contains(q{Got a single line comment index 5}, '_parse_lean_test_steps : various single line comments - 1');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : various single line comments - 2');
# multi line comment within quote
before_test();
$main::unit_test_steps = <<'EOB'
# assertcount: 5
--= This truly is a comment
this: too
=--
step: Single line comment within quote
shell: echo NOP
verifypositive:[[: [[
--= not: a comment
more: content
=--
also: content]]
verifynegative: bad stuff
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifynegative' => 'bad stuff'}, '_parse_lean_test_steps : multi line comment in quote - 1');
assert_stdout_does_not_contain(q{'20' =>}, '_parse_lean_test_steps : multi line comment in quote - 2');
assert_stdout_contains(q{'verifypositive' => '}, '_parse_lean_test_steps : multi line comment in quote - 3');
assert_stdout_does_not_contain(q{'assert_count' =>}, '_parse_lean_test_steps : multi line comment in quote - 4');
assert_stdout_contains(q{'verifypositive' => .*not: a comment}, '_parse_lean_test_steps : multi line comment in quote - 5');
assert_stdout_contains(q{'verifypositive' => .*more: content}, '_parse_lean_test_steps : multi line comment in quote - 6');
assert_stdout_does_not_contain(q{'this' => 'too'}, '_parse_lean_test_steps : multi line comment in quote - 7');
assert_stdout_contains(q{'verifypositive' => .*also: content}, '_parse_lean_test_steps : multi line comment in quote - 8');
# multi line quote with blank lines
before_test();
$main::unit_test_steps = <<'EOB'
step: Multi line quote with blank lines
shell: echo NOP
verifypositive:[[: [[
one fish
two fish
]]
verifynegative: bad stuff
# the end
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive' => .*one fish}, '_parse_lean_test_steps : multi line quote with blank lines - 1');
assert_stdout_contains(q{'verifypositive' => .*two fish}, '_parse_lean_test_steps : multi line quote with blank lines - 2');
# ends with multi line quote
before_test();
$main::unit_test_steps = <<'EOB'
step: Ends with multi line quote
shell: echo NOP
verifypositive:[[: [[
one fish
two fish
]]
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifypositive' => .*one fish}, '_parse_lean_test_steps : ends with multi line quote - 1');
assert_stdout_contains(q{'verifypositive' => .*two fish}, '_parse_lean_test_steps : ends with multi line quote - 2');
# test within a test
before_test();
$main::unit_test_steps = <<'EOB'
step: Test within a test
url: http://webimblaze.server/webimblaze/server/submit/?batch=Unit&target=test
postbody:-=-: -=-
step: Ends with multi line quote
shell: echo NOP
verifypositive:[[: [[
one fish
two fish
]]
-=-
verifynegative: Severe error
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifynegative' => 'Severe error'}, '_parse_lean_test_steps : test within a test - 1');
assert_stdout_contains(q{'postbody' => .*step: Ends}, '_parse_lean_test_steps : test within a test - 2');
assert_stdout_contains(q{'postbody' => .*shell: echo NOP}, '_parse_lean_test_steps : test within a test - 3');
assert_stdout_contains(q{'postbody' => .*verifypositive:\\[\\[: \\[\\[}, '_parse_lean_test_steps : test within a test - 4');
# edge cases
before_test();
$main::unit_test_steps = <<'EOB'
--= Various comments
# comment in comment
=--
# single line comment
step: Edge cases
verifynegative10: Error
url: http://webimblaze.server/webimblaze/server/submit/?batch=Unit&target=test
postbody:-=-: -=-
step: Ends with multi line quote
shell: echo NOP
verifypositive:[[: [[
one fish
two fish
]]
-=-
--= Multi mid
=--
# single mid
verifynegative: Severe error
# single end
# Favourite
step: Step 20
shell: echo NOP
--=
=--
step: Step 30
shell1: REM
shell2: echo off
#
--=
=--
EOB
;
read_test_steps_file();
assert_stdout_contains(q{'verifynegative' => 'Severe error'}, '_parse_lean_test_steps : Edge cases - 1');
assert_stdout_contains(q{'30' =>}, '_parse_lean_test_steps : Edge cases - 2');
assert_stdout_contains(q{'shell2' => 'echo off'}, '_parse_lean_test_steps : Edge cases - 3');
assert_stdout_does_not_contain(q{'' =>}, '_parse_lean_test_steps : Edge cases - 4');
assert_stdout_does_not_contain(q{'40' =>}, '_parse_lean_test_steps : Edge cases - 5');