Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pugs fudge
  • Loading branch information
coke committed Apr 12, 2012
1 parent 4128c59 commit 23a618d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
18 changes: 14 additions & 4 deletions S02-names-vars/perl.t
Expand Up @@ -2,11 +2,14 @@ use v6;
use Test;
# L<S02/Names and Variables/To get a Perlish representation of any object>

#?pugs emit plan 78;

my @tests = (
# Basic scalar values
42,
42/10,
4.2,
#?pugs emit #
sqrt(2),
3e5,
Inf, -Inf, NaN,
Expand All @@ -24,36 +27,42 @@ my @tests = (
Mu,
#?rakudo emit # parse error
#?niecza emit # Autoloading NYI
#?pugs emit #
rx:P5/foo/, rx:P5//, rx:P5/^.*$/,

# References to scalars
\42, \Inf, \-Inf, \NaN, \"string", \"", \?1, \?0, \Mu,

#?pugs emit #
(a => 1),
#?pugs emit #
:b(2),

# References to aggregates
#?pugs emit #
{}, # empty hash
#?pugs emit #
{ a => 42 }, # only one elem
#?pugs emit #
{ :a(1), :b(2), :c(3) },

# Nested things
#?pugs emit #
{ a => [1,2,3] }, # only one elem
#?pugs emit #
{ a => [1,2,3], b => [4,5,6] },
#?pugs emit #
[ { :a(1) }, { :b(2), :c(3) } ],

# a Parcel
<a b c>
);

#?pugs emit force_todo 8, 45..50, 94, 96;

#?pugs emit unless $?PUGS_BACKEND eq "BACKEND_PUGS" {
#?pugs emit skip_rest "eval() not yet implemented in $?PUGS_BACKEND.";
#?pugs emit exit;
#?pugs emit }


# L<S02/Names and Variables/To get a Perlish representation of any object>
# Quoting S02 (emphasis added):
# To get a Perlish representation of any data value, use the .perl method.
Expand Down Expand Up @@ -125,7 +134,7 @@ my @tests = (
ok $t1_new ne $t1_init, 'changing object changes .perl output';

# TODO: more tests that show eval($t1_init) has the same guts as $t1.

#?pugs todo
ok $t1_new ~~ /<< krach >>/, 'attribute value appears in .perl output';
}

Expand All @@ -144,6 +153,7 @@ my @tests = (
class RT67790 {}
lives_ok { RT67790.HOW.perl }, 'can .perl on .HOW';
#?niecza skip '>>>Stub code executed'
#?pugs todo
ok eval(RT67790.HOW.perl) === RT67790.HOW, '... and it returns the right thing';
}

Expand Down
3 changes: 3 additions & 0 deletions S02-names-vars/varnames.t
Expand Up @@ -7,8 +7,10 @@ plan 8;
# L<S02/Names and Variables/special variables of Perl 5 are going away>

#?niecza todo
#?pugs todo
eval_dies_ok 'my $!', '$! can not be declared again';
#?niecza todo
#?pugs todo
eval_dies_ok 'my $/', 'nor can $/';

#?rakudo 2 todo 'proto on variable declarations'
Expand All @@ -21,6 +23,7 @@ eval_dies_ok 'my $f!ao = "beh";', "normal varnames can't have ! in their name";
eval_dies_ok 'my $fo:o::b:ar = "bla"', "var names can't have colons in their names either";

#?rakudo skip 'binding to $/ (questionable?)'
#?pugs skip "Can't modify constant item: VObject"
{
class MyMatch {
method postcircumfix:<[ ]>($x) {
Expand Down
2 changes: 2 additions & 0 deletions S04-statements/if.t
Expand Up @@ -113,6 +113,7 @@ if (Mu) { flunk('if (Mu) {} failed'); } else { pass('if (Mu) {} works'); }
}

# L<S04/"Conditional statements"/The value of the conditional expression may be optionally bound to a closure parameter>
#?pugs skip 'Cannot bind to non-existing variable: "$a"'
{
my ($got, $a_val, $b_val);
my sub testa { $a_val };
Expand Down Expand Up @@ -162,6 +163,7 @@ if (Mu) { flunk('if (Mu) {} failed'); } else { pass('if (Mu) {} works'); }


# L<S04/Statement parsing/keywords require whitespace>
#?pugs todo
eval_dies_ok('if($x > 1) {}','keyword needs at least one whitespace after it');

# RT #76174
Expand Down
2 changes: 2 additions & 0 deletions S12-attributes/recursive.t
Expand Up @@ -35,10 +35,12 @@ Test attributes with recursively typed attributes
};

my B $a;
#?pugs todo
lives_ok {
$a .= new();
B.attr = $a;
}, "Can instantiate class with recursively-typed class lexical";
#?pugs skip 'Undeclared variable'
ok B.attr === $a, "Recursively-typed class lexical stores correctly";

}
Expand Down
8 changes: 8 additions & 0 deletions S32-scalar/undef.t
@@ -1,6 +1,8 @@
use v6;
use Test;
#?pugs emit #
BEGIN { @*INC.push('t/spec/packages/') };
#?pugs emit #
use Test::Util;

=begin pod
Expand Down Expand Up @@ -40,6 +42,7 @@ ok(!defined(Mu), "Mu is not defined");
$a += 1;
ok(defined($a), "initialized var is defined");
#?niecza todo
#?pugs skip 'is_run'
is_run( 'my $a; $a += 1', { err => '', out => '', status => 0 },
'increment of undefined variable does not warn' );

Expand Down Expand Up @@ -141,6 +144,7 @@ ok(!defined(Mu), "Mu is not defined");
# XXX shouldn't that be * instead of undef?
# yes, this chunk should move to a different file --Larry

#?pugs skip "Can't modify constant item: VNum Infinity"
{
my $interesting;
(*, *, $interesting) = (1,2,3);
Expand Down Expand Up @@ -177,16 +181,20 @@ Perl6-specific tests
ok(defined($ary_r), "array reference");

undefine @ary;
#?pugs todo
ok(!+$ary_r, "undefine array referent");

#?pugs todo
is(+$ary_r, 0, "dangling array reference");

my %hash = (1, 2, 3, 4);
my $hash_r = %hash;
#?pugs todo
isa_ok($hash_r, "Hash");
ok(defined($hash_r), "hash reference");
undefine %hash;
ok(defined($hash_r), "undefine hash referent:");
#?pugs todo
is(+$hash_r.keys, 0, "dangling hash reference");
}

Expand Down

0 comments on commit 23a618d

Please sign in to comment.