mostly working
[gitmo/MooseX-Types-UUID.git] / t / 01-basic.t
diff --git a/t/01-basic.t b/t/01-basic.t
new file mode 100644 (file)
index 0000000..7d8461a
--- /dev/null
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+use Test::Exception;
+use Test::More tests => 2;
+
+{ package Class;
+  use Moose;
+  use MooseX::Types::UUID qw(UUID);
+  
+  has 'uuid' => ( is => 'ro', isa => UUID );
+}
+
+lives_ok {
+    Class->new( uuid => '77C71F92-0EC7-11DD-B986-DF138EE79F6F' );
+} 'valid UUID works';
+
+throws_ok {
+    Class->new( uuid => 'there is no way you could possibly think this is a UUID' );
+} qr/does not pass the type constraint/;