Commits

Toby Inkster  committed 795c60d

check error messages

  • Participants
  • Parent commits 3624af4
  • Tags 0.004

Comments (0)

Files changed (1)

File t/04taxonomy.t

 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::More;
 
 use Try::Tiny;
 use Throwable::Factory
 	ok( $_->DOES('Throwable::Taxonomy::NotImplemented') );
 };
 
+ok not eval q { use Throwable::Factory D => ['-foobar']; D(); 1 };
+like $@, qr/Shortcut '-foobar' has no matches/;
+
+{
+	package Local::Error::Foobar;
+	use Moo::Role;
+	push @Throwable::Factory::SHORTCUTS, __PACKAGE__;
+}
+
+ok eval q { use Throwable::Factory E => ['-foobar']; E(); 1 };
+
+{
+	package Local::Error2::Foobar;
+	use Moo::Role;
+	push @Throwable::Factory::SHORTCUTS, __PACKAGE__;
+}
+
+ok not eval q { use Throwable::Factory F => ['-foobar']; F(); 1 };
+like $@, qr/Shortcut '-foobar' has too many matches/;
+
+done_testing;