Browse files

Fudge S06-advanced_subroutine_features/caller.t for Niecza (only one …

…test passes, but it is at least one Pugs failed)
  • Loading branch information...
1 parent c318940 commit 78711fd57e1624ad892dcc6e8dd443d836ba78a5 @sorear sorear committed May 31, 2011
Showing with 28 additions and 22 deletions.
  1. +28 −22 S06-advanced_subroutine_features/caller.t
View
50 S06-advanced_subroutine_features/caller.t
@@ -2,14 +2,15 @@ use v6;
use Test;
-plan 19;
+
# L<S06/The C<callframe> and C<caller> functions>
# caller.subname
sub a_sub { b_sub() }
sub b_sub { try { caller.subname } }
#?pugs todo "feature"
+#?niecza skip "try interferes with caller counting"
is ~a_sub(), "a_sub", "caller.sub works";
# caller.file
@@ -19,7 +20,8 @@ ok index(~(try { caller.file }), "caller") >= 0, "caller.file works";
# caller.line (XXX: make sure to edit the expected line number!)
#?pugs 2 todo "feature"
sub call_line { caller.line };
-is call_line(), 22, "caller.line works";
+#?niecza skip "fudge messes up the line numbers"
+is call_line(), 23, "caller.line works";
# pugs: caller exposes a bug in the MMD mechanism where directly using autogenerated
# accessors on an object returned by a factory, rather than storing the object
@@ -35,35 +37,39 @@ class A { method try_it_caller_A { &Main::try_it_caller(@_) } }
sub try_it_caller_caller { A.try_it_caller_A(@_) }
class B { method try_it_caller_B { &Main::try_it_caller_caller(@_) } }
+#?DOES 1
sub chain { B.try_it_caller_B(@_) }
# pugs: must use parentheses after caller
# basic tests of caller object
-chain({ WHAT caller() }, "Control::Caller", "caller object type");
-chain({ caller().package }, "Main", "caller package");
-chain({ caller().file }, $?FILE, "caller filename");
-chain({ caller().line }, "33", "caller line");
-chain({ caller().subname }, "&Main::try_it_caller", "caller subname");
-chain({ caller().subtype }, "SubRoutine", "caller subtype"); # specme
-chain({ caller().sub }, &try_it_caller, "caller sub (code)");
+#?niecza skip "NYI"
+{
+ chain({ WHAT caller() }, "Control::Caller", "caller object type");
+ chain({ caller().package }, "Main", "caller package");
+ chain({ caller().file }, $?FILE, "caller filename");
+ chain({ caller().line }, "32", "caller line");
+ chain({ caller().subname }, "&Main::try_it_caller", "caller subname");
+ chain({ caller().subtype }, "SubRoutine", "caller subtype"); # specme
+ chain({ caller().sub }, &try_it_caller, "caller sub (code)");
+}
# select by code type
-chain({ caller(Any).subname }, "&Main::try_it_caller", "code type - Any");
-chain({ caller("Any").subname }, "&Main::try_it_caller", "code type - Any (string)");
-chain({ caller(Method).subname }, "&A::try_it_caller_A", "code type - Method");
-chain({ caller("Moose") }, Mu, "code type - not found");
-
-# :skip
-chain({ caller(:skip<1>).subname }, "&A::try_it_caller_A", ":skip<1>");
-chain({ caller(:skip<128>) }, Mu, ":skip<128> - not found");
-
-# type + :skip
-chain({ caller(Sub, :skip<1>).subname }, "&Main::try_it_caller_caller", "Sub, :skip<1>");
-chain({ caller(Sub, :skip<2>).subname }, "&Main::chain", "Sub, :skip<2>");
-chain({ caller(Method, :skip<1>).subname }, "&B::try_it_caller_B", "Method, :skip<1>");
+#?niecza skip "NYI"
+{
+ chain({ caller(Any).subname }, "&Main::try_it_caller", "code type - Any");
+ chain({ caller("Any").subname }, "&Main::try_it_caller", "code type - Any (string)");
+ chain({ caller(Method).subname }, "&A::try_it_caller_A", "code type - Method");
+ chain({ caller("Moose") }, Mu, "code type - not found");
+ chain({ caller(:skip<1>).subname }, "&A::try_it_caller_A", ":skip<1>");
+ chain({ caller(:skip<128>) }, Mu, ":skip<128> - not found");
+ chain({ caller(Sub, :skip<1>).subname }, "&Main::try_it_caller_caller", "Sub, :skip<1>");
+ chain({ caller(Sub, :skip<2>).subname }, "&Main::chain", "Sub, :skip<2>");
+ chain({ caller(Method, :skip<1>).subname }, "&B::try_it_caller_B", "Method, :skip<1>");
+}
# WRITEME: label tests
+done;
# vim: ft=perl6

0 comments on commit 78711fd

Please sign in to comment.