Skip to content
Browse files

[t] move blocks/splat_rw.t to spec/

git-svn-id: http://svn.pugscode.org/pugs@22147 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 954ca6a commit 530e7f112d153ab1b8cf0d821eb4ada44bd47eea moritz committed
Showing with 39 additions and 0 deletions.
  1. +39 −0 S06-traits/slurpy-is-rw.t
View
39 S06-traits/slurpy-is-rw.t
@@ -0,0 +1,39 @@
+use v6;
+
+use Test;
+
+=begin description
+
+Splatted parameters shouldn't be rw even if stated as such
+
+=end description
+
+plan 3;
+
+# test splatted parameter for rw ability
+# L<S06/"Subroutine traits"/"is rw">
+
+my @test = 1..5;
+try {
+ my sub should_work ( *@list is rw ) {
+ @list[0] = "hi";
+ }
+ should_work(@test);
+};
+
+ok(
+ !$!,
+ "trying to use an 'is rw' splat does work out",
+);
+is(@test[0], "hi", "@test was unchanged");
+
+try {
+ my sub should_work (*@list is rw) { }
+};
+
+ok(
+ !$!,
+ "trying to define an 'is rw' splat works too",
+);
+
+# vim: ft=perl6

0 comments on commit 530e7f1

Please sign in to comment.
Something went wrong with that request. Please try again.