Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add basic "use trace" sanity test
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| use v6; | ||
|
|
||
| use Test; | ||
|
|
||
| plan 3; | ||
|
|
||
| my $filename = "$?FILE.trace"; | ||
| my $stderr = "$filename.stderr"; | ||
|
|
||
| spurt( $filename, q:to/CODE/ ); | ||
| my $a = 42; | ||
| if $a { | ||
| use trace; | ||
| $a++; | ||
| no trace; | ||
| $a--; | ||
| } | ||
| $a += 1; | ||
| use trace; | ||
| $a -= 1; | ||
| no trace; | ||
| say $a; | ||
| CODE | ||
|
|
||
| my $p = pipe( "$*EXECUTABLE $filename 2>$stderr" ); | ||
| ok $p, "did we get a handle?"; | ||
| is $p.lines.join, "42", "is the program output ok?"; | ||
| is slurp($stderr), qq:to/STDERR/, "is the trace ok?"; | ||
| 4 ($filename:4) | ||
| \$a++ | ||
| 10 ($filename:10) | ||
| \$a -= 1 | ||
| STDERR | ||
|
|
||
| unlink $filename, $stderr; |