Permalink
Browse files

[t] move operators/recursive_definition.t to spec/, and add a simpler…

… test as well

git-svn-id: http://svn.pugscode.org/pugs@22432 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
moritz
moritz committed Sep 27, 2008
1 parent 258ac7a commit ad116dbf750d7f268bfea63574af760cf7ccb9d9
Showing with 28 additions and 0 deletions.
  1. +28 −0 S13-overloading/operators.t
@@ -0,0 +1,28 @@
+use v6;
+use Test;
+
+plan 2;
+
+#L<S06/Operator overloading>
+
+{
+ ok eval(q[
+ sub postfix:<§> ($x) {
+ $x * 2;
+ };
+ 3§;
+ ]) == 6, 'Can define postfix operator';
+}
+
+{
+ ok eval(q[
+ sub postfix:<!>($arg) {
+ if ($arg == 0) { 1;}
+ else { ($arg-1)! * $arg;}
+ };
+ 5!
+ ]) == 120, 'Can define recursive postfix operator';
+}
+
+
+# vim: ft=perl6

0 comments on commit ad116db

Please sign in to comment.