From 8bf5e6931a1bd96df0cdb1ceb94bbb3e578a8126 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 4 Sep 2013 19:38:21 -0400 Subject: packaging --- t/no-new-constructor-error.t | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 t/no-new-constructor-error.t (limited to 't/no-new-constructor-error.t') diff --git a/t/no-new-constructor-error.t b/t/no-new-constructor-error.t new file mode 100644 index 0000000..2becbce --- /dev/null +++ b/t/no-new-constructor-error.t @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +{ + package NonMoose; + sub create { bless {}, shift } + sub DESTROY { } +} + +{ + package Child; + use Moose; + use MooseX::NonMoose; + extends 'NonMoose'; + { + my $warning; + local $SIG{__WARN__} = sub { $warning = $_[0] }; + __PACKAGE__->meta->make_immutable; + ::like( + $warning, + qr/Not inlining.*doesn't contain a constructor named 'new'/, + "warning when trying to make_immutable without a superclass 'new'" + ); + } +} + +{ + package ChildTwo; + use Moose; + use MooseX::NonMoose; + extends 'NonMoose'; + { + my $warning; + local $SIG{__WARN__} = sub { $warning = $_[0] }; + __PACKAGE__->meta->make_immutable(inline_constructor => 0); + ::is($warning, undef, + "no warning when trying to make_immutable(inline_constructor => 0) without a superclass 'new'"); + } +} + +done_testing; -- cgit v1.2.3-54-g00ecf