1
1
# !perl -T
2
2
3
- package main ;
3
+ package T::Object::TinyDefaults ;
4
4
5
- use 5.018;
6
- use strict;
7
- use warnings;
8
- use Test::More tests => 27;
5
+ use AxkTest;
6
+ use parent ' Test::Class' ;
9
7
10
- BEGIN {
11
- use_ok( ' Object::TinyDefaults' ) || print " Bail out!\n " ;
12
- }
8
+ sub class { " Object::TinyDefaults" };
13
9
14
- diag( " Testing Object::TinyDefaults $Object::TinyDefaults::VERSION , Perl $] , $^X" );
10
+ sub startup :Tests(startup => 1) {
11
+ my $test = shift ;
12
+ use_ok $test -> class;
13
+ diag( " Testing Object::TinyDefaults $Object::TinyDefaults::VERSION , Perl $] , $^X" );
14
+ }
15
15
16
16
# No defaults ===================================================== {{{1
17
17
package NoDefaults {
18
18
use Object::TinyDefaults qw( foo bar) ;
19
19
}
20
20
21
- package main {
21
+ package T::Object::TinyDefaults {
22
+ sub no_defaults : Tests {
22
23
my $x = NoDefaults-> new();
23
24
isa_ok($x , ' NoDefaults' );
24
25
isa_ok($x , ' Object::TinyDefaults' );
@@ -29,14 +30,15 @@ package main {
29
30
is($x -> foo, 42, ' numeric assignment' );
30
31
is($x -> bar, ' yes' , ' string assignment' );
31
32
}
32
-
33
+ }
33
34
# }}}1
34
35
# Defaults and field names ======================================== {{{1
35
36
package DefaultsAndNames {
36
37
use Object::TinyDefaults { foo => ' default' }, qw( foo bar) ;
37
38
}
38
39
39
- package main {
40
+ package T::Object::TinyDefaults {
41
+ sub defaults_and_names : Tests {
40
42
my $x = DefaultsAndNames-> new();
41
43
isa_ok($x , ' DefaultsAndNames' );
42
44
isa_ok($x , ' Object::TinyDefaults' );
@@ -47,14 +49,16 @@ package main {
47
49
is($x -> foo, 42, ' numeric assignment' );
48
50
is($x -> bar, ' yes' , ' string assignment' );
49
51
}
52
+ }
50
53
51
54
# }}}1
52
55
# Defaults and field names; some names only in defaults =========== {{{1
53
56
package DefaultsWithNamesAndNames {
54
57
use Object::TinyDefaults { quux => ' default' }, qw( foo bar) ;
55
58
}
56
59
57
- package main {
60
+ package T::Object::TinyDefaults {
61
+ sub defaults_with_names_and_names {
58
62
my $x = DefaultsWithNamesAndNames-> new();
59
63
isa_ok($x , ' DefaultsWithNamesAndNames' );
60
64
isa_ok($x , ' Object::TinyDefaults' );
@@ -68,14 +72,16 @@ package main {
68
72
is($x -> foo, 42, ' numeric assignment' );
69
73
is($x -> bar, ' yes' , ' string assignment' );
70
74
}
75
+ }
71
76
72
77
# }}}1
73
78
# Defaults only =================================================== {{{1
74
79
package DefaultsOnly {
75
80
use Object::TinyDefaults { quux => ' default' , foo => 42 };
76
81
}
77
82
78
- package main {
83
+ package T::Object::TinyDefaults {
84
+ sub defaults_only {
79
85
my $x = DefaultsOnly-> new();
80
86
isa_ok($x , ' DefaultsOnly' );
81
87
isa_ok($x , ' Object::TinyDefaults' );
@@ -86,9 +92,9 @@ package main {
86
92
is($x -> quux, ' yes' , ' string assignment (quux)' );
87
93
is($x -> foo, ' indeed' , ' string assignment (foo)' );
88
94
}
95
+ }
89
96
90
97
# }}}1
91
98
92
- # done_testing();
93
-
99
+ 1;
94
100
# vi: set ts=4 sts=4 sw=4 et ai fdm=marker fdl=0: #
0 commit comments