Permalink
Browse files

[t/spec] Test for RT #69740

git-svn-id: http://svn.pugscode.org/pugs@28779 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ce64005 commit eafb05ca77c8809d8d626babd14c6f638fa06326 moritz committed Oct 13, 2009
Showing with 16 additions and 7 deletions.
  1. +16 −7 S04-declarations/constant.t
@@ -2,30 +2,37 @@ use v6;
use Test;
-plan 33;
+plan *;
# L<S04/The Relationship of Blocks and Declarations/"The new constant declarator">
# Following tests test whether the declaration succeeded.
#?pugs todo 'feature'
{
- my $ok;
-
constant foo = 42;
- $ok = foo == 42;
- ok $ok, "declaring a sigilless constant using 'constant' works";
+ ok foo == 42, "declaring a sigilless constant using 'constant' works";
+ dies_ok { foo = 3 }, "can't reasign to a sigil-less constant";
}
{
my $ok;
constant $bar = 42;
- $ok = $bar == 42;
+ ok $bar == 42, "declaring a constant with a sigil using 'constant' works";
+ dies_ok { $bar = 2 }, "Can't reasign to a sigiled constant";
+}
- ok $ok, "declaring a constant with a sigil using 'constant' works";
+#?rakudo skip 'RT 69740'
+{
+ constant ($a, $b) = (3, 4);
+ is $a, 3, 'multiple constant in one declaration(1)';
+ is $b, 4, 'multiple constant in one declaration(2)';
+ dies_ok { $a = 4 }, 'and they are really constant (1)';
+ dies_ok { $b = 4 }, 'and they are really constant (2)';
}
+
{
{
constant foo2 = 42;
@@ -239,4 +246,6 @@ plan 33;
'assign constant its own value from expression';
}
+done_testing;
+
# vim: ft=perl6

0 comments on commit eafb05c

Please sign in to comment.