Permalink
Browse files

[gsoc_spectest] adding test for :$whatever notation (added 4 tests)

git-svn-id: http://svn.pugscode.org/pugs@21898 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 0cc228a commit d76524a42eabb19745ed169e22fb4df98104f736 Auzon committed Aug 14, 2008
Showing with 19 additions and 0 deletions.
  1. +19 −0 S02-builtin_data_types/pair.t
@@ -301,3 +301,22 @@ L<"http://www.nntp.perl.org/group/perl.perl6.language/20122">
is $val, "new", "binding .value to a var works (3)", :todo<bug>;
is $pair.value, "new", "binding .value to a var works (4)", :todo<bug>;
}
+
+# L<S06/Named arguments/In other words :$when is shorthand for :when($when)>
+{
+ my $item = 'bar';
+ my $pair = (:$item);
+ ok($pair eqv (item => $item), ':$foo syntax works');
+
+ my @arr = <a b c d e f>;
+ my $pair = (:@arr);
+ ok($pair eqv (arr => @arr), ':@foo syntax works');
+
+ my %hash = foo => 'bar', baz => 'qux';
+ my $pair = (:%hash);
+ ok($pair eqv (hash => %hash), ':%foo syntax works');
+
+ my sub code {return 42}
+ my $pair = (:&code);
+ ok($pair eqv (code => &code), ':&foo syntax works');
+}

0 comments on commit d76524a

Please sign in to comment.