Permalink
Browse files

[t/spec] corrected rounders.t; fudged for rakudo (ugly mess)

simplified brainos.t a bit


git-svn-id: http://svn.pugscode.org/pugs@22098 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent e75ccb3 commit ee7b7ebb479989a2c300029eb34e2328e5f7341a moritz committed Sep 2, 2008
Showing with 24 additions and 3 deletions.
  1. +1 −1 S03-operators/brainos.t
  2. +23 −2 S29-num/rounders.t
View
@@ -15,7 +15,7 @@ the user instead.
#L<S03/Chaining binary precedence/"To catch">
my $str = 'foo';
-eval q{$str =~ m/bar/;};
+eval '$str =~ m/bar/;';
if $!.defined {
pass "caught =~ braino, saying $!";
}
View
@@ -22,7 +22,7 @@ my %tests =
[ -0.5, -1 ], [ -0.499, -1 ], [ -5.499, -6 ] ],
round => [ [ 1.5, 2 ], [ 2, 2 ], [ 1.4999, 1 ],
[ -0.1, 0 ], [ -1, -1 ], [ -5.9, -6 ],
- [ -0.5, -1 ], [ -0.499, 0 ], [ -5.499, -5 ] ],
+ [ -0.5, 0 ], [ -0.499, 0 ], [ -5.499, -5 ] ],
truncate => [ [ 1.5, 1 ], [ 2, 2 ], [ 1.4999, 1 ],
[ -0.1, 0 ], [ -1, -1 ], [ -5.9, -5 ],
[ -0.5, 0 ], [ -0.499, 0 ], [ -5.499, -5 ] ],
@@ -33,11 +33,32 @@ my %tests =
#?pugs emit exit;
#?pugs emit }
+# XXX rakudo has a bug with list flattening that prevents us from
+# running the tests, and I haven't found a way to work around it without
+# breaking the test for pugs. So here is our cheating version rakudo.
+# Will stop working once list assignment is fixed
+
+#?rakudo emit for %tests.keys.sort -> $type {
+#?rakudo emit my @subtests = %tests{$type};
+#?rakudo emit for @subtests -> $t, $ref {
+#?rakudo emit my $code = "{$type}($t)";
+#?rakudo emit my $res = eval $code;
+#?rakudo emit if ($!) {
+#?rakudo emit flunk("failed to parse $code ($!)");
+#?rakudo emit } else {
+#?rakudo emit ok($res == $ref, "$code == $ref");
+#?rakudo emit };
+#?rakudo emit };
+#?rakudo emit };
+#?rakudo emit
+#?rakudo emit exit 1;
+
for %tests.keys.sort -> $type {
my @subtests = @(%tests{$type}); # XXX .[] doesn't work yet!
for @subtests -> $test {
my $code = "{$type}($test[0])";
- my $res = eval($code);
+ my $res = eval($code);
+
if ($!) {
#?pugs todo 'feature'
flunk("failed to parse $code ($!)");

0 comments on commit ee7b7eb

Please sign in to comment.