Commit this failed experiment
[gitmo/MooseX-Compiler.git] / t / constructor.t
index 11a25cf..ffbc1f7 100644 (file)
@@ -23,6 +23,7 @@ EOF
     );
 
     my $compiled = $compiler->compile_class();
+
     like(
         $compiled,
         qr/sub new {.+\n}\n/s,
@@ -38,4 +39,34 @@ EOF
     }
 }
 
+{
+    my $code = <<'EOF';
+use Moose;
+
+has a1 => (
+    is      => 'ro',
+    isa     => 'Int',
+    default => 42,
+);
+
+sub foo { 42 }
+EOF
+
+    my $class = 'Test::Class2';
+    save_fragment( $class, $code );
+
+    my $compiler = MooseX::Compiler->new(
+        class => $class,
+    );
+
+    my $compiled = $compiler->compile_class();
+warn $compiled;
+
+    like(
+        $compiled,
+        qr/sub new {.+\n}\n/s,
+        'compiled code has a constructor'
+    );
+}
+
 done_testing();