Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add multi-method tests from nqpclr, which now pass in nqp-rx/nom.
  • Loading branch information
jnthn committed Jan 16, 2011
1 parent b6b076d commit f4fe15c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions t/nqp/55-multi-method.t
@@ -0,0 +1,40 @@
#! nqp

plan(4);

class Foo {
proto method bar($x?) { * }
multi method bar() { 42 }
multi method bar($x) { 2 * $x }
}

my $x := Foo.new();

if $x.bar() == 42 {
say("ok 1");
}

if $x.bar(5) == 10 {
say("ok 2");
}

class Baz is Foo {
multi method bar() { 37 }
}

my $y := Baz.new();

if $y.bar() == 37 {
say("ok 3");
}

class Quux is Foo {
proto method bar() { * }
multi method bar() { 37 }
}

my $z := Quux.new();

if $z.bar() == 37 {
say("ok 4");
}

0 comments on commit f4fe15c

Please sign in to comment.