Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[t] merged is_copy_ne_is_rw.t into is-copy.t

git-svn-id: http://svn.pugscode.org/pugs@25151 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 603f99869a3e2d48650fd03783713a4c60c9518a 1 parent aa4168e
moritz authored
Showing with 20 additions and 1 deletion.
  1. +20 −1 S06-traits/is-copy.t
21 S06-traits/is-copy.t
View
@@ -4,7 +4,7 @@ use Test;
# L<S06/"Parameter traits"/"=item is copy">
# should be moved with other subroutine tests?
-plan 3;
+plan 10;
{
sub foo($a is copy) {
@@ -17,3 +17,22 @@ plan 3;
is foo($bar), 19, "calling a sub with an is copy param";
is $bar, 23, "sub did not change our variable";
}
+{
+ sub copy_tester ($copy_tester is copy = 5, $bar is copy = 10) {
+ $copy_tester += $bar;
+ $copy_tester;
+ }
+
+ is(copy_tester(), 15, 'calling without arguments');
+
+ is(copy_tester(10), 20, 'calling with one argument');
+ is(copy_tester(10, 15), 25, 'calling with two arguments');
+
+ my ($baz, $quux) = (10, 15);
+
+ is(copy_tester($baz), 20, 'calling with one argument');
+ is($baz, 10, 'variable was not affected');
+
+ is(copy_tester($baz, $quux), 25, 'calling with two arguments');
+ is($baz, 10, 'variable was not affected');
+}
Please sign in to comment.
Something went wrong with that request. Please try again.