Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A few more MMD tests
  • Loading branch information
sorear committed Apr 2, 2011
1 parent 39cf462 commit 2bdc3ff
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/Kernel.cs
Expand Up @@ -1889,6 +1889,7 @@ public class MMDCandidateLongname {
Frame dth = th;
while ((dth.info.param0 as P6any[]) == null) dth = dth.outer;

Console.WriteLine("---");
foreach (P6any p in dth.info.param0 as P6any[])
Console.WriteLine((new MMDCandidateLongname(p)).LongName());

Expand All @@ -1897,7 +1898,9 @@ public class MMDCandidateLongname {
//if (cs == null)
// dth.info.param1 = cs = MMDAnalyze(dth.info.param0 as P6any[]);

throw new NieczaException("NYFI");
if (tailcall) th = th.caller;
th.resultSlot = NewROScalar(AnyP);
return th;
}

private static Frame StandardTypeProtoC(Frame th) {
Expand Down
24 changes: 20 additions & 4 deletions test2.pl
Expand Up @@ -69,12 +69,28 @@
ok "y" ~~ / :lang(G19) <foo> /, "can use multi regex without proto";

my class C20 {
multi method bar(Bool $) { "bool" }
multi method bar(Str $) { "str" }
multi method b1(Bool $) { "bool" }
multi method b1(Str $) { "str" }

multi method b2(Bool $) { "bool" }
multi method b2(Any $) { "any" }

multi method b3(Any $) { "any" }
multi method b3(Bool $) { "bool" }

multi method b4(Bool $ , Any $) { "doom" }
multi method b4(Any $ , Bool $) { "doom" }
}

is C20.bar(True), "bool", "multimethods work (1)";
is C20.bar("foo"), "str", "multimethods work (2)";
is C20.b1(True), "bool", "multimethods work (1)";
is C20.b1("foo"), "str", "multimethods work (2)";

is C20.b2(True), "bool", "multimethod sorting works (1)";
is C20.b2("foo"), "any", "multimethod sorting works (1)";
is C20.b3(True), "bool", "multimethod sorting works (1)";
is C20.b3("foo"), "any", "multimethod sorting works (1)";

dies_ok { C20.b4("foo", "bar") }, "multimethod tie checking works";
}

#is $?FILE, 'test.pl', '$?FILE works';
Expand Down

0 comments on commit 2bdc3ff

Please sign in to comment.