Author: kjs
Date: Mon Apr  9 03:53:11 2007
New Revision: 18060

Added:
   trunk/compilers/pirc/t/pirc.t
   trunk/compilers/pirc/t/stmts.pir
   trunk/compilers/pirc/t/subflags.pir
Removed:
   trunk/compilers/pirc/t/sub.t

Log:
compilers/pirc:
* make 'make test' work correctly
* add 'framework' in 'pirc.t', add first 2 test files (.pir files)

Added: trunk/compilers/pirc/t/pirc.t
==============================================================================
--- (empty file)
+++ trunk/compilers/pirc/t/pirc.t       Mon Apr  9 03:53:11 2007
@@ -0,0 +1,56 @@
+#!perl
+
+use strict;
+use warnings;
+use lib qw( . ../../../lib);
+use Test::More;
+use Parrot::Config;
+
+# This is the test framework for compilers/pirc.
+# We don't need to run Parrot, so run pirc directly
+# for each file in the current (/t) directory.
+#
+
+my $numtests;
+my @files;
+
+# calculate number of tests:
+BEGIN {
+    # test all files in current directory
+    my $dir = ".";
+
+    # get all files
+    @files = <$dir/*>;
+
+    # get number of files
+    $numtests = @files;
+    $numtests--;
+
+}
+
+
+
+# set number of tests to be run
+use Parrot::Test tests => $numtests;
+
+# start testing:
+my $count = 1;
+
+foreach my $file (@files) {
+    # skip this file
+    next if $file eq "./pirc.t";
+    my $cmd = "../pirc $file";
+    run_command($cmd);
+    ok($count, "");
+    $count++;
+}
+
+
+
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/compilers/pirc/t/stmts.pir
==============================================================================
--- (empty file)
+++ trunk/compilers/pirc/t/stmts.pir    Mon Apr  9 03:53:11 2007
@@ -0,0 +1,17 @@
+.sub main
+    .local pmc x, y, z
+    .local string a, b, c
+    .local int i, j
+    .local num pi
+
+    pi = 3.14
+
+    if x < y goto X
+
+X:
+
+.end
+
+.sub foo
+
+.end

Added: trunk/compilers/pirc/t/subflags.pir
==============================================================================
--- (empty file)
+++ trunk/compilers/pirc/t/subflags.pir Mon Apr  9 03:53:11 2007
@@ -0,0 +1,11 @@
+.sub main :main
+
+.end
+
+.sub foo :load, :init
+
+.end
+
+.sub bar :vtable('get_string')
+
+.end

Reply via email to