I found which motivated said tests.
if (scalar @_ == 1) {
if (defined $_[0]) {
(ref($_[0]) eq 'HASH')
- || $class->throw_error("Single parameters to new() must be a HASH ref", data => $_[0]);
+ || $class->meta->throw_error("Single parameters to new() must be a HASH ref", data => $_[0]);
return {%{$_[0]}};
}
else {
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+use Test::Exception;
+
+# This tests the error handling in Moose::Object only
+
+{
+ package Foo;
+ use Moose;
+}
+
+throws_ok { Foo->new('bad') } qr/^\QSingle parameters to new() must be a HASH ref/,
+ 'A single non-hashref arg to a constructor throws an error';
+
+throws_ok { Foo->does() } qr/^\QYou much supply a role name to does()/,
+ 'Cannot call does() without a role name';