Author: coke
Date: Wed Mar 22 11:37:07 2006
New Revision: 11987

Added:
   trunk/languages/APL/t/APL.pm
Modified:
   trunk/languages/APL/t/simple.t

Log:
[APL]
~ Try switching to Test::Base in an effort to simplify test writing.



Added: trunk/languages/APL/t/APL.pm
==============================================================================
--- (empty file)
+++ trunk/languages/APL/t/APL.pm        Wed Mar 22 11:37:07 2006
@@ -0,0 +1,36 @@
+package t::APL;
+
+use Test::Base -Base;
+use Parrot::Config;
+use Parrot::Test;
+
+our @EXPORT = qw(run_apl_is);
+
+BEGIN {
+  # APL *really* needs unicode to function, bail out if we don't have it.
+  if (!$PConfig{has_icu}) {
+    plan skip_all => "No unicode library available.";
+    exit 0;
+  }
+}
+
+filters {
+  output => qw/ chomp /
+};
+
+
+# Note - we don't just use the special SKIP entry in the DATA stream because
+# it doesn't actually output the skipped test in the TAP output. It just
+# fails to run the test.
+
+sub run_apl_is() {
+  foreach my $block (blocks) {
+    my $apl    = $block->APL;
+    my $output = $block->out;
+    my $skip   = $block->skip;
+    SKIP: {
+      skip($skip, 1) if $skip;
+      Parrot::Test::language_output_is('APL', $apl, $output, $block->name);
+    }
+  }
+}

Modified: trunk/languages/APL/t/simple.t
==============================================================================
--- trunk/languages/APL/t/simple.t      (original)
+++ trunk/languages/APL/t/simple.t      Wed Mar 22 11:37:07 2006
@@ -1,55 +1,41 @@
 #!/usr/bin/perl
 
-use strict;
 use lib qw(t . lib ../lib ../../lib ../../../lib);
-use Parrot::Config;
-use Parrot::Test;
-use Test::More;
-
-# APL really needs unicode to function
-$PConfig{has_icu}
-  ? plan tests => 7
-  : plan skip_all => "No unicode library available.";
-
-
-language_output_is('APL', <<'CODE', '20', 'scalar multiplication');
-print 10 × 2
-CODE
-
-language_output_is('APL', <<'CODE', '20', 'scalar multiplication');
-print 10 * 2
-CODE
-
-TODO: {
-  local $TODO = "characters don't work yet.";
-
-language_output_is('APL', <<'CODE', q{he said, "she said."}, 'double quotes');
-print "he said, ""she said."""
-CODE
-
-language_output_is('APL', <<'CODE', q{surely you can't be serious}, 'single 
quotes');
-print 'surely you can''t be serious.'
-CODE
-}
-
-TODO: {
-  local $TODO = "basic vector support missing";
-
-language_output_is('APL', <<'CODE', '10 2 3', 'vectors');
-print 10 2 3
-CODE
-}
-
-TODO: {
-  local $TODO = "use same glyph in monadic and dyadic forms...";
-
-language_output_is('APL', <<'CODE', '3', 'ceiling (scalar)');
-print ⌈ 2.5
-CODE
-
-language_output_is('APL', <<'CODE', '3', 'maximum (scalar)');
-print  2 ⌈ 3
-CODE
-}
-  
+use t::APL tests => 7;
 
+run_apl_is();
+
+__DATA__
+
+=== 'double quotes'
+--- APL: print "he said, ""she said."""
+--- out: he said, "she said."
+--- skip: characters don't work yet.
+
+=== 'single quotes'
+--- APL: print 'surely you can''t be serious.'
+--- out: surely you can't be serious
+--- skip: characters don't work yet.
+
+=== vectors
+--- APL: print 10 2 3
+--- out: 10 2 3
+--- skip: basic vector support missing
+
+=== ceiling (scalar)
+--- APL: print ⌈ 2.5
+--- out: 3
+--- skip: use same glyph in monadic and dyadic forms
+
+=== maximum (scalar)
+--- APL: print 2 ⌈ 3
+--- out: 3
+--- skip: use same glyph in monadic and dyadic forms
+
+=== scalar multiplication
+--- APL: print 10 × 2
+--- out: 20
+
+=== scalar multiplication (ascii)
+--- APL: print 10 * 2
+--- out: 20

Reply via email to