File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ use v6 ;
2
+
3
+ use Test ;
4
+
5
+ plan 1 ;
6
+
7
+ subtest {
8
+ plan 1 ;
9
+
10
+ my $ example-name = " 10-01arguments.pl" ;
11
+ my $ expected-output = q :to /EOD /;
12
+ old-fashioned
13
+ some parameter
14
+ some parameter
15
+ some parameter
16
+ some parameter
17
+ array
18
+ elements
19
+ are => pairs
20
+ hash => elements
21
+ this
22
+ Told you it was optional!
23
+ this
24
+ that
25
+ 123
26
+ 123
27
+ Transporting to Magrathea:
28
+ Arthur
29
+ Ford
30
+ Ovid
31
+ You gave me the integer: 3
32
+ EOD
33
+
34
+ my $ output = run-example($ example-name );
35
+ is ($ output , $ expected-output , $ example-name );
36
+ }, " 10-01arguments.pl" ;
37
+
38
+ # | run the given example script
39
+ sub run-example ($ name , : $ script-args = Nil ) {
40
+ my $ base-dir = " categories/cookbook/10subroutines" ;
41
+ my $ script-path = $ base-dir ~ " /" ~ $ name ;
42
+ my $ base-cmd = " perl6 $ script-path" ;
43
+ my $ output = $ script-args ?? qqx { $ base-cmd \" $ script-args\" }
44
+ !! qqx { $ base-cmd} ;
45
+
46
+ return $ output ;
47
+ }
48
+
49
+ # vim: expandtab shiftwidth=4 ft=perl6
You can’t perform that action at this time.
0 commit comments