Permalink
Browse files

Add failing tests for return of empty method

  • Loading branch information...
sorear committed Mar 2, 2010
1 parent 262251f commit 573aa5def2af5a3f944d062a6b7304f124a0a0e9
Showing with 29 additions and 0 deletions.
  1. +29 −0 t/empty_body.t
View
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+use Test::More;
+
+{
+ package Foo;
+
+ use Moose;
+ use MooseX::Method::Signatures;
+
+ method empty() { }
+ method empty_with_arg($foo) { }
+}
+
+my $o = Foo->new;
+
+sub retvals {
+ return scalar(@_);
+}
+
+is(retvals($o->empty), 0, "Empty method returns no values in list context");
+ok(!defined($o->empty), "Empty method returns undef in scalar context");
+
+is(retvals($o->empty_with_arg(42)), 0,
+ "Argument processing does not leak into list returns");
+ok(!defined($o->empty_with_arg(42)),
+ "Argument processing does not leak into scalar returns");
+
+done_testing;

0 comments on commit 573aa5d

Please sign in to comment.