Import tests for Test::Mouse
Fuji, Goro [Tue, 28 Sep 2010 13:06:53 +0000 (22:06 +0900)]
t/500_test_moose/001_test_moose.t [new file with mode: 0644]
t/500_test_moose/002_test_moose_does_ok.t [new file with mode: 0644]
t/500_test_moose/003_test_moose_has_attribute_ok.t [new file with mode: 0644]
t/500_test_moose/004_test_moose_meta_ok.t [new file with mode: 0644]
t/500_test_moose/005_with_immutable.t [new file with mode: 0644]

diff --git a/t/500_test_moose/001_test_moose.t b/t/500_test_moose/001_test_moose.t
new file mode 100644 (file)
index 0000000..2d70ec8
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+    use_ok('Test::Mouse');
+}
+
+done_testing;
diff --git a/t/500_test_moose/002_test_moose_does_ok.t b/t/500_test_moose/002_test_moose_does_ok.t
new file mode 100644 (file)
index 0000000..feb4a2f
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+
+use strict;
+use warnings;
+
+use Test::Builder::Tester;
+use Test::More;
+
+BEGIN {
+  use_ok('Test::Mouse');
+}
+
+{
+    package Foo;
+    use Mouse::Role;
+}
+
+{
+    package Bar;
+    use Mouse;
+
+    with qw/Foo/;
+}
+
+{
+    package Baz;
+    use Mouse;
+}
+
+# class ok
+
+test_out('ok 1 - does_ok class');
+
+does_ok('Bar','Foo','does_ok class');
+
+# class fail
+
+test_out ('not ok 2 - does_ok class fail');
+test_fail (+2);
+
+does_ok('Baz','Foo','does_ok class fail');
+
+# object ok
+
+my $bar = Bar->new;
+
+test_out ('ok 3 - does_ok object');
+
+does_ok ($bar,'Foo','does_ok object');
+
+# object fail
+
+my $baz = Baz->new;
+
+test_out ('not ok 4 - does_ok object fail');
+test_fail (+2);
+
+does_ok ($baz,'Foo','does_ok object fail');
+
+test_test ('does_ok');
+
+done_testing;
diff --git a/t/500_test_moose/003_test_moose_has_attribute_ok.t b/t/500_test_moose/003_test_moose_has_attribute_ok.t
new file mode 100644 (file)
index 0000000..f652830
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+
+use strict;
+use warnings;
+
+use Test::Builder::Tester;
+use Test::More;
+
+BEGIN {
+  use_ok('Test::Mouse');
+}
+
+{
+    package Foo;
+    use Mouse;
+
+    has 'foo', is => 'bare';
+}
+
+{
+    package Bar;
+    use Mouse;
+
+    extends 'Foo';
+
+    has 'bar', is => 'bare';
+}
+
+
+test_out('ok 1 - ... has_attribute_ok(Foo, foo) passes');
+
+has_attribute_ok('Foo', 'foo', '... has_attribute_ok(Foo, foo) passes');
+
+test_out ('not ok 2 - ... has_attribute_ok(Foo, bar) fails');
+test_fail (+2);
+
+has_attribute_ok('Foo', 'bar', '... has_attribute_ok(Foo, bar) fails');
+
+test_out('ok 3 - ... has_attribute_ok(Bar, foo) passes');
+
+has_attribute_ok('Bar', 'foo', '... has_attribute_ok(Bar, foo) passes');
+
+test_out('ok 4 - ... has_attribute_ok(Bar, bar) passes');
+
+has_attribute_ok('Bar', 'bar', '... has_attribute_ok(Bar, bar) passes');
+
+test_test ('has_attribute_ok');
+
+done_testing;
diff --git a/t/500_test_moose/004_test_moose_meta_ok.t b/t/500_test_moose/004_test_moose_meta_ok.t
new file mode 100644 (file)
index 0000000..dc3141e
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+
+use strict;
+use warnings;
+
+use Test::Builder::Tester;
+use Test::More;
+
+BEGIN {
+  use_ok('Test::Mouse');
+}
+
+{
+    package Foo;
+    use Mouse;
+}
+
+{
+    package Bar;
+}
+
+test_out('ok 1 - ... meta_ok(Foo) passes');
+
+meta_ok('Foo', '... meta_ok(Foo) passes');
+
+test_out ('not ok 2 - ... meta_ok(Bar) fails');
+test_fail (+2);
+
+meta_ok('Bar', '... meta_ok(Bar) fails');
+
+test_test ('meta_ok');
+
+done_testing;
diff --git a/t/500_test_moose/005_with_immutable.t b/t/500_test_moose/005_with_immutable.t
new file mode 100644 (file)
index 0000000..cab3a7b
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+
+use strict;
+use warnings;
+
+use Test::Builder::Tester;
+use Test::More;
+
+BEGIN {
+  use_ok('Test::Mouse');
+}
+
+{
+    package Foo;
+    use Mouse;
+}
+
+{
+    package Bar;
+    use Mouse;
+}
+
+package main;
+
+test_out("ok 1", "not ok 2");
+test_fail(+2);
+my $ret = with_immutable {
+    ok(Foo->meta->is_mutable);
+} qw(Foo);
+test_test('with_immutable failure');
+ok(!$ret, "one of our tests failed");
+
+test_out("ok 1", "ok 2");
+$ret = with_immutable {
+    ok(Bar->meta->find_method_by_name('new'));
+} qw(Bar);
+test_test('with_immutable success');
+ok($ret, "all tests succeeded");
+
+done_testing;