Source

perl-XML-GrammarBase / XML-GrammarBase / t / data_dir.t

Diff from to

XML-GrammarBase/t/data_dir.t

 #!/usr/bin/perl
 
+package MyClass::WithDataDir;
+
+use MooX 'late';
+
+with ('XML::GrammarBase::Role::DataDir');
+
+has '+module_base' => (default => 'XML::Grammar::MyGrammar');
+
+package main;
+
 use strict;
 use warnings;
 
 use Test::More tests => 1;
 
-package MyClass::WithDataDir;
+{
+    my $obj;
+    eval
+    {
+        # TEST
+        $obj = MyClass::WithDataDir->new;
+        my $test = $obj->module_base;
+    };
 
-use Test::More;
+    my $Err = $@;
 
-use MooX 'late';
-
-BEGIN
-{
-with ('XML::GrammarBase::Role::DataDir');
-};
-
-eval {
-
-has '+module_base' => (default => 'XML::Grammar::MyGrammar');
-
-};
-
-# TEST
-ok ($@, "Validation error for colon delimited values.");
+    # TEST
+    like ($Err, qr/isa check for "module_base" failed/,
+        "Accessing module_base threw an exception",
+    );
+}
 
 =head1 COPYRIGHT & LICENSE