File tree Expand file tree Collapse file tree 1 file changed +22
-39
lines changed Expand file tree Collapse file tree 1 file changed +22
-39
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use Test ;
4
4
5
+ use lib ' t/spec/packages' ;
6
+ use Test ::Util;
7
+
8
+ plan 2 ;
9
+
5
10
= begin pod
6
11
7
12
Test C < -p > implementation
@@ -18,44 +23,22 @@ switch, and wraps the whole script in
18
23
19
24
# L<S19/Reference/"Act like sed.">
20
25
21
- my @ examples = (
22
- ' -p' ,
23
- ' -p "-e1;"' ,
24
- ' -pe ";"' ,
25
- ' -pe ""' ,
26
- ' -p "-e1;" "-e1;"' ,
27
- ' "-e1;" -p "-e1;"' ,
26
+ is_run(
27
+ ' 1' , # program
28
+ " foo\n " , # input
29
+ {
30
+ out => " foo\n " , # expected
31
+ },
32
+ ' -p -e 1 works like cat' ,
33
+ : compiler-args[' -p' ],
28
34
);
29
35
30
- plan + @ examples ;
31
-
32
- diag " Running under $ * OS" ;
33
-
34
- my ($ redir_in ,$ redir_out ) = (" <" , " >" );
35
-
36
- my $ str = "
37
- foo
38
- bar
39
- " ;
40
-
41
- sub nonce () { return (" .{ $ * PID } ." ~ (1 .. 1000 ). pick ) }
42
- my ($ in_fn , $ out_fn ) = <temp-ex-input temp-ext-output > >>~>> nonce ;
43
- my $ h = open (" $ in_fn" , : w);
44
- $ h . print ($ str );
45
- $ h . close ();
46
-
47
- for @ examples -> $ ex {
48
- my $ command = " $ * EXECUTABLE_NAME $ ex $ redir_in $ in_fn $ redir_out $ out_fn" ;
49
- diag $ command ;
50
- run $ command ;
51
-
52
- my $ expected = $ str ;
53
- my $ got = slurp $ out_fn ;
54
- unlink $ out_fn ;
55
-
56
- is $ got , $ expected , " $ ex works like cat" ;
57
- }
58
-
59
- unlink $ in_fn ;
60
-
61
- # vim: ft=perl6
36
+ is_run(
37
+ ' s:g/o/a/' , # program
38
+ " foo\n bar\n " , # input
39
+ {
40
+ out => " faa\n bar\n " ,
41
+ },
42
+ ' -p works in combination with s:g///' ,
43
+ : compiler-args[' -p' ],
44
+ );
You can’t perform that action at this time.
0 commit comments