Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add failing tests for return of empty method

  • Loading branch information...
commit 573aa5def2af5a3f944d062a6b7304f124a0a0e9 1 parent 262251f
@sorear authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 t/empty_body.t
View
29 t/empty_body.t
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.