Skip to content

Instantly share code, notes, and snippets.

@snarkyboojum
Created May 11, 2010 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snarkyboojum/397105 to your computer and use it in GitHub Desktop.
Save snarkyboojum/397105 to your computer and use it in GitHub Desktop.
use v6;
use Test;
plan *;
use Tardis;
use Yapsi;
my Yapsi::Compiler $c .= new;
my Tardis::Debugger $d .= new;
my @programs-ticks =
'', 0, 'empty program',
'my $a', 1, 'uninitialised variable',
'my $a = 42', 2, 'initalised variable',
'my $a = 42; ++$a', 3, 'pre-increment',
'my $a = 42; my $b; { $b = 5 }', 3, 'immediate blocks',
'my $a = 42; { my $b = 5 }', 4, 'variable initialisation in immediate blocks',
'{}; my $a = 42; { my $b = 5 };', 4, 'multiple immediate blocks',
;
for @programs-ticks -> $program, $ticks, $message {
my @sic = $c.compile($program);
$d.run(@sic);
is +$d.ticks, $ticks, $message;
}
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment