Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add basic "use trace" sanity test
  • Loading branch information
lizmat committed May 24, 2015
1 parent 24aca6a commit bdf5c7d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions t/01-sanity/55-use-trace.t
@@ -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;

0 comments on commit bdf5c7d

Please sign in to comment.