summaryrefslogtreecommitdiff
path: root/t/basics/super_warns_on_args.t
diff options
context:
space:
mode:
Diffstat (limited to 't/basics/super_warns_on_args.t')
-rw-r--r--t/basics/super_warns_on_args.t44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/basics/super_warns_on_args.t b/t/basics/super_warns_on_args.t
new file mode 100644
index 0000000..3600d9f
--- /dev/null
+++ b/t/basics/super_warns_on_args.t
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::Requires 'Test::Output';
+use Test::More;
+
+{
+ package Parent;
+ use Moose;
+
+ sub foo { 42 }
+ sub bar { 42 }
+
+ package Child;
+ use Moose;
+
+ extends 'Parent';
+
+ override foo => sub {
+ super( 1, 2, 3 );
+ };
+
+ override bar => sub {
+ super();
+ };
+}
+
+{
+ my $file = __FILE__;
+
+ stderr_like(
+ sub { Child->new->foo },
+ qr/\QArguments passed to super() are ignored at $file/,
+ 'got a warning when passing args to super() call'
+ );
+
+ stderr_is(
+ sub { Child->new->bar },
+ q{},
+ 'no warning on super() call without arguments'
+ );
+}
+
+done_testing();