New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defining several constants with parentheses doesn't work in Rakudo #1359
Comments
From @masak<moritz_> perl6: constant ($a, $b) = 1, 2; say "$a $b" |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S04-declarations/constant.t commit bb301917e805250f795bccf238ad292f33376700 [t/spec] Test for RT #69740 Inline Patchdiff --git a/t/spec/S04-declarations/constant.t b/t/spec/S04-declarations/constant.t
index fade05c..b207465 100644
--- a/t/spec/S04-declarations/constant.t
+++ b/t/spec/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 |
The RT System itself - Status changed from 'new' to 'open' |
From @bbkr[12:23] <bbkr> std: constant ($a, $b) = 1,2; taking ticket... |
From @bbkrthere was already test for constant list assignment forbidden in unfudged it. |
@bbkr - Status changed from 'open' to 'resolved' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S04-declarations/constant.t commit 0b93fd8ad7b19c5ca28b5456306327e4be20fb31 [t/spec] tests for RT #69740 Defining several constants with parentheses Inline Patchdiff --git a/t/spec/S04-declarations/constant.t b/t/spec/S04-declarations/constant.t
index 9b2b871..412ae35 100644
--- a/t/spec/S04-declarations/constant.t
+++ b/t/spec/S04-declarations/constant.t
@@ -23,7 +23,7 @@ plan *;
dies_ok { $bar = 2 }, "Can't reassign to a sigiled constant";
}
-#?rakudo skip 'RT 69740'
+# RT #69740
{
eval_dies_ok 'constant ($a, $b) = (3, 4)', 'constant no longer takes list';
} |
Migrated from rt.perl.org#69740 (status was 'resolved')
Searchable as RT69740$
The text was updated successfully, but these errors were encountered: