From: Fuji, Goro Date: Tue, 28 Sep 2010 13:06:53 +0000 (+0900) Subject: Import tests for Test::Mouse X-Git-Tag: 0.77~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca5d8e24b0fe72efa902c71c54480865411672b2;p=gitmo%2FMouse.git Import tests for Test::Mouse --- diff --git a/t/500_test_moose/001_test_moose.t b/t/500_test_moose/001_test_moose.t new file mode 100644 index 0000000..2d70ec8 --- /dev/null +++ b/t/500_test_moose/001_test_moose.t @@ -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 index 0000000..feb4a2f --- /dev/null +++ b/t/500_test_moose/002_test_moose_does_ok.t @@ -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 index 0000000..f652830 --- /dev/null +++ b/t/500_test_moose/003_test_moose_has_attribute_ok.t @@ -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 index 0000000..dc3141e --- /dev/null +++ b/t/500_test_moose/004_test_moose_meta_ok.t @@ -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 index 0000000..cab3a7b --- /dev/null +++ b/t/500_test_moose/005_with_immutable.t @@ -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;