Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Re-write the nqp-builtins cheats into NQP and stick 'em in the setting.
  • Loading branch information
jnthn committed Mar 13, 2011
1 parent 3dd30e3 commit 76d887f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 70 deletions.
2 changes: 1 addition & 1 deletion build/Makefile.in
Expand Up @@ -85,13 +85,13 @@ NQP_SOURCES = \
src/NQP/Actions.pm \
src/NQP/Compiler.pm \
src/NQP/Compiler.pir \
src/cheats/nqp-builtins.pir \

CORE_SETTING_SOURCES = \
src/core/NativeTypes.pm \
src/core/NQPMu.pm \
src/core/IO.pm \
src/core/Regex.pm \
src/core/testing.pm \

CORE_SETTING_NQP = NQPCORE.setting

Expand Down
1 change: 0 additions & 1 deletion src/NQP/Compiler.pir
Expand Up @@ -40,7 +40,6 @@ NQP::Compiler - NQP compiler
.include 'gen/nqp-grammar.pir'
.include 'gen/nqp-actions.pir'
.include 'gen/nqp-compiler.pir'
.include 'src/cheats/nqp-builtins.pir'

.namespace ['NQP';'Compiler']

Expand Down
68 changes: 0 additions & 68 deletions src/cheats/nqp-builtins.pir

This file was deleted.

11 changes: 11 additions & 0 deletions src/core/IO.pm
Expand Up @@ -47,4 +47,15 @@ sub spew($filename, $contents) {
$handle.close();
}

sub print(*@args) {
for @args {
pir::print($_);
}
1;
}

sub say(*@args) {
print(|@args, "\n");
}

# vim: ft=perl6
25 changes: 25 additions & 0 deletions src/core/testing.pm
@@ -0,0 +1,25 @@
my $test_counter := 0;

sub plan($quantity) {
say("1..$quantity");
}

sub ok($condition, $desc?) {
$test_counter := $test_counter + 1;

unless $condition {
print("not ");
}
print("ok $test_counter");
if $desc {
print(" - $desc");
}
print("\n");

$condition ?? 1 !! 0
}

sub skip($desc) {
$test_counter := $test_counter + 1;
say("ok $test_counter # SKIP $desc\n");
}

0 comments on commit 76d887f

Please sign in to comment.