[libtype-tiny-perl] 12/14: tests for Error::TypeTiny class

Jonas Smedegaard dr at jones.dk
Fri May 30 17:41:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.043_03
in repository libtype-tiny-perl.

commit 79b6359a0b25541fec7a403b63e4e618bde5aaad
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date:   Tue May 6 21:09:02 2014 +0100

    tests for Error::TypeTiny class
---
 t/20-unit/Error-TypeTiny/basic.t | 46 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/t/20-unit/Error-TypeTiny/basic.t b/t/20-unit/Error-TypeTiny/basic.t
new file mode 100644
index 0000000..ade70f8
--- /dev/null
+++ b/t/20-unit/Error-TypeTiny/basic.t
@@ -0,0 +1,46 @@
+=pod
+
+=encoding utf-8
+
+=head1 PURPOSE
+
+Tests for basic L<Error::TypeTiny> functionality.
+
+=head1 AUTHOR
+
+Toby Inkster E<lt>tobyink at cpan.orgE<gt>.
+
+=head1 COPYRIGHT AND LICENCE
+
+This software is copyright (c) 2013-2014 by Toby Inkster.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw( ./lib ./t/lib ../inc ./inc );
+
+use Test::More;
+use Test::Fatal;
+use Error::TypeTiny;
+
+#line 31 "basic.t"
+my $e1 = exception { 'Error::TypeTiny'->throw() };
+
+is($e1->message, 'An exception has occurred', '$e1->message (default)');
+is($e1->context->{package}, 'main', '$e1->context->{main}');
+is($e1->context->{line}, '31', '$e1->contex1t->{line}');
+is($e1->context->{file}, 'basic.t', '$e1->context->{file}');
+
+my $e2 = exception { 'Error::TypeTiny'->throw(message => 'oh dear') };
+
+is($e2->message, 'oh dear', '$e2->message');
+
+my $e3 = exception { Error::TypeTiny::croak('oh %s', 'drat') };
+
+is($e3->message, 'oh drat', '$e3->message (set by croak)');
+
+done_testing;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtype-tiny-perl.git



More information about the Pkg-perl-cvs-commits mailing list