fixing the authors lists and adding the ClassName type constraint
[gitmo/Moose.git] / t / 052_util_std_type_constraints.t
CommitLineData
a15dff8d 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
9af1d28b 6use Test::More tests => 269;
a15dff8d 7use Test::Exception;
8
9use Scalar::Util ();
10
11BEGIN {
12 use_ok('Moose::Util::TypeConstraints');
13}
14
15my $SCALAR_REF = \(my $var);
94b8bbb8 16
17no warnings 'once'; # << I *hates* that warning ...
3f7376b0 18my $GLOB_REF = \*GLOB_REF;
a15dff8d 19
0a5bd159 20my $fh;
21open($fh, '<', $0) || die "Could not open $0 for the test";
22
7c13858b 23Moose::Util::TypeConstraints->export_type_contstraints_as_functions();
182134e8 24
a15dff8d 25ok(defined Any(0), '... Any accepts anything');
26ok(defined Any(100), '... Any accepts anything');
27ok(defined Any(''), '... Any accepts anything');
28ok(defined Any('Foo'), '... Any accepts anything');
29ok(defined Any([]), '... Any accepts anything');
30ok(defined Any({}), '... Any accepts anything');
31ok(defined Any(sub {}), '... Any accepts anything');
32ok(defined Any($SCALAR_REF), '... Any accepts anything');
3f7376b0 33ok(defined Any($GLOB_REF), '... Any accepts anything');
0a5bd159 34ok(defined Any($fh), '... Any accepts anything');
a15dff8d 35ok(defined Any(qr/../), '... Any accepts anything');
36ok(defined Any(bless {}, 'Foo'), '... Any accepts anything');
5a4c5493 37ok(defined Any(undef), '... Any accepts anything');
38
39ok(defined Item(0), '... Item is the base type, so accepts anything');
40ok(defined Item(100), '... Item is the base type, so accepts anything');
41ok(defined Item(''), '... Item is the base type, so accepts anything');
42ok(defined Item('Foo'), '... Item is the base type, so accepts anything');
43ok(defined Item([]), '... Item is the base type, so accepts anything');
44ok(defined Item({}), '... Item is the base type, so accepts anything');
45ok(defined Item(sub {}), '... Item is the base type, so accepts anything');
46ok(defined Item($SCALAR_REF), '... Item is the base type, so accepts anything');
3f7376b0 47ok(defined Item($GLOB_REF), '... Item is the base type, so accepts anything');
0a5bd159 48ok(defined Item($fh), '... Item is the base type, so accepts anything');
5a4c5493 49ok(defined Item(qr/../), '... Item is the base type, so accepts anything');
50ok(defined Item(bless {}, 'Foo'), '... Item is the base type, so accepts anything');
51ok(defined Item(undef), '... Item is the base type, so accepts anything');
52
53ok(defined Defined(0), '... Defined accepts anything which is defined');
54ok(defined Defined(100), '... Defined accepts anything which is defined');
55ok(defined Defined(''), '... Defined accepts anything which is defined');
56ok(defined Defined('Foo'), '... Defined accepts anything which is defined');
57ok(defined Defined([]), '... Defined accepts anything which is defined');
58ok(defined Defined({}), '... Defined accepts anything which is defined');
59ok(defined Defined(sub {}), '... Defined accepts anything which is defined');
60ok(defined Defined($SCALAR_REF), '... Defined accepts anything which is defined');
3f7376b0 61ok(defined Defined($GLOB_REF), '... Defined accepts anything which is defined');
0a5bd159 62ok(defined Defined($fh), '... Defined accepts anything which is defined');
5a4c5493 63ok(defined Defined(qr/../), '... Defined accepts anything which is defined');
64ok(defined Defined(bless {}, 'Foo'), '... Defined accepts anything which is defined');
65ok(!defined Defined(undef), '... Defined accepts anything which is defined');
66
67ok(!defined Undef(0), '... Undef accepts anything which is not defined');
68ok(!defined Undef(100), '... Undef accepts anything which is not defined');
69ok(!defined Undef(''), '... Undef accepts anything which is not defined');
70ok(!defined Undef('Foo'), '... Undef accepts anything which is not defined');
71ok(!defined Undef([]), '... Undef accepts anything which is not defined');
72ok(!defined Undef({}), '... Undef accepts anything which is not defined');
73ok(!defined Undef(sub {}), '... Undef accepts anything which is not defined');
74ok(!defined Undef($SCALAR_REF), '... Undef accepts anything which is not defined');
3f7376b0 75ok(!defined Undef($GLOB_REF), '... Undef accepts anything which is not defined');
0a5bd159 76ok(!defined Undef($fh), '... Undef accepts anything which is not defined');
5a4c5493 77ok(!defined Undef(qr/../), '... Undef accepts anything which is not defined');
78ok(!defined Undef(bless {}, 'Foo'), '... Undef accepts anything which is not defined');
79ok(defined Undef(undef), '... Undef accepts anything which is not defined');
80
81ok(defined Bool(0), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
82ok(defined Bool(1), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
83ok(!defined Bool(100), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
84ok(defined Bool(''), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
85ok(!defined Bool('Foo'), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
86ok(!defined Bool([]), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
87ok(!defined Bool({}), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
88ok(!defined Bool(sub {}), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
89ok(!defined Bool($SCALAR_REF), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
3f7376b0 90ok(!defined Bool($GLOB_REF), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
0a5bd159 91ok(!defined Bool($fh), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
5a4c5493 92ok(!defined Bool(qr/../), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
93ok(!defined Bool(bless {}, 'Foo'), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
94ok(defined Bool(undef), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
5204cd52 95
a15dff8d 96ok(defined Value(0), '... Value accepts anything which is not a Ref');
97ok(defined Value(100), '... Value accepts anything which is not a Ref');
98ok(defined Value(''), '... Value accepts anything which is not a Ref');
99ok(defined Value('Foo'), '... Value accepts anything which is not a Ref');
100ok(!defined Value([]), '... Value rejects anything which is not a Value');
101ok(!defined Value({}), '... Value rejects anything which is not a Value');
102ok(!defined Value(sub {}), '... Value rejects anything which is not a Value');
103ok(!defined Value($SCALAR_REF), '... Value rejects anything which is not a Value');
3f7376b0 104ok(!defined Value($GLOB_REF), '... Value rejects anything which is not a Value');
0a5bd159 105ok(!defined Value($fh), '... Value rejects anything which is not a Value');
a15dff8d 106ok(!defined Value(qr/../), '... Value rejects anything which is not a Value');
107ok(!defined Value(bless {}, 'Foo'), '... Value rejects anything which is not a Value');
5a4c5493 108ok(!defined Value(undef), '... Value rejects anything which is not a Value');
a15dff8d 109
110ok(!defined Ref(0), '... Ref accepts anything which is not a Value');
111ok(!defined Ref(100), '... Ref accepts anything which is not a Value');
112ok(!defined Ref(''), '... Ref accepts anything which is not a Value');
113ok(!defined Ref('Foo'), '... Ref accepts anything which is not a Value');
114ok(defined Ref([]), '... Ref rejects anything which is not a Ref');
115ok(defined Ref({}), '... Ref rejects anything which is not a Ref');
116ok(defined Ref(sub {}), '... Ref rejects anything which is not a Ref');
117ok(defined Ref($SCALAR_REF), '... Ref rejects anything which is not a Ref');
3f7376b0 118ok(defined Ref($GLOB_REF), '... Ref rejects anything which is not a Ref');
0a5bd159 119ok(defined Ref($fh), '... Ref rejects anything which is not a Ref');
a15dff8d 120ok(defined Ref(qr/../), '... Ref rejects anything which is not a Ref');
121ok(defined Ref(bless {}, 'Foo'), '... Ref rejects anything which is not a Ref');
5a4c5493 122ok(!defined Ref(undef), '... Ref rejects anything which is not a Ref');
a15dff8d 123
124ok(defined Int(0), '... Int accepts anything which is an Int');
125ok(defined Int(100), '... Int accepts anything which is an Int');
5a4c5493 126ok(!defined Int(0.5), '... Int accepts anything which is not a Int');
127ok(!defined Int(100.01), '... Int accepts anything which is not a Int');
a15dff8d 128ok(!defined Int(''), '... Int rejects anything which is not a Int');
129ok(!defined Int('Foo'), '... Int rejects anything which is not a Int');
130ok(!defined Int([]), '... Int rejects anything which is not a Int');
131ok(!defined Int({}), '... Int rejects anything which is not a Int');
132ok(!defined Int(sub {}), '... Int rejects anything which is not a Int');
133ok(!defined Int($SCALAR_REF), '... Int rejects anything which is not a Int');
3f7376b0 134ok(!defined Int($GLOB_REF), '... Int rejects anything which is not a Int');
0a5bd159 135ok(!defined Int($fh), '... Int rejects anything which is not a Int');
a15dff8d 136ok(!defined Int(qr/../), '... Int rejects anything which is not a Int');
137ok(!defined Int(bless {}, 'Foo'), '... Int rejects anything which is not a Int');
5a4c5493 138ok(!defined Int(undef), '... Int rejects anything which is not a Int');
139
140ok(defined Num(0), '... Num accepts anything which is an Num');
141ok(defined Num(100), '... Num accepts anything which is an Num');
142ok(defined Num(0.5), '... Num accepts anything which is an Num');
143ok(defined Num(100.01), '... Num accepts anything which is an Num');
144ok(!defined Num(''), '... Num rejects anything which is not a Num');
145ok(!defined Num('Foo'), '... Num rejects anything which is not a Num');
146ok(!defined Num([]), '... Num rejects anything which is not a Num');
147ok(!defined Num({}), '... Num rejects anything which is not a Num');
148ok(!defined Num(sub {}), '... Num rejects anything which is not a Num');
149ok(!defined Num($SCALAR_REF), '... Num rejects anything which is not a Num');
3f7376b0 150ok(!defined Num($GLOB_REF), '... Num rejects anything which is not a Num');
0a5bd159 151ok(!defined Num($fh), '... Num rejects anything which is not a Num');
5a4c5493 152ok(!defined Num(qr/../), '... Num rejects anything which is not a Num');
153ok(!defined Num(bless {}, 'Foo'), '... Num rejects anything which is not a Num');
154ok(!defined Num(undef), '... Num rejects anything which is not a Num');
155
156ok(defined Str(0), '... Str accepts anything which is a Str');
157ok(defined Str(100), '... Str accepts anything which is a Str');
a15dff8d 158ok(defined Str(''), '... Str accepts anything which is a Str');
159ok(defined Str('Foo'), '... Str accepts anything which is a Str');
160ok(!defined Str([]), '... Str rejects anything which is not a Str');
161ok(!defined Str({}), '... Str rejects anything which is not a Str');
162ok(!defined Str(sub {}), '... Str rejects anything which is not a Str');
163ok(!defined Str($SCALAR_REF), '... Str rejects anything which is not a Str');
0a5bd159 164ok(!defined Str($fh), '... Str rejects anything which is not a Str');
3f7376b0 165ok(!defined Str($GLOB_REF), '... Str rejects anything which is not a Str');
a15dff8d 166ok(!defined Str(qr/../), '... Str rejects anything which is not a Str');
167ok(!defined Str(bless {}, 'Foo'), '... Str rejects anything which is not a Str');
5a4c5493 168ok(!defined Str(undef), '... Str rejects anything which is not a Str');
a15dff8d 169
170ok(!defined ScalarRef(0), '... ScalarRef rejects anything which is not a ScalarRef');
171ok(!defined ScalarRef(100), '... ScalarRef rejects anything which is not a ScalarRef');
172ok(!defined ScalarRef(''), '... ScalarRef rejects anything which is not a ScalarRef');
173ok(!defined ScalarRef('Foo'), '... ScalarRef rejects anything which is not a ScalarRef');
174ok(!defined ScalarRef([]), '... ScalarRef rejects anything which is not a ScalarRef');
175ok(!defined ScalarRef({}), '... ScalarRef rejects anything which is not a ScalarRef');
176ok(!defined ScalarRef(sub {}), '... ScalarRef rejects anything which is not a ScalarRef');
177ok(defined ScalarRef($SCALAR_REF), '... ScalarRef accepts anything which is a ScalarRef');
3f7376b0 178ok(!defined ScalarRef($GLOB_REF), '... ScalarRef rejects anything which is not a ScalarRef');
0a5bd159 179ok(!defined ScalarRef($fh), '... ScalarRef rejects anything which is not a ScalarRef');
a15dff8d 180ok(!defined ScalarRef(qr/../), '... ScalarRef rejects anything which is not a ScalarRef');
181ok(!defined ScalarRef(bless {}, 'Foo'), '... ScalarRef rejects anything which is not a ScalarRef');
5a4c5493 182ok(!defined ScalarRef(undef), '... ScalarRef rejects anything which is not a ScalarRef');
a15dff8d 183
184ok(!defined ArrayRef(0), '... ArrayRef rejects anything which is not a ArrayRef');
185ok(!defined ArrayRef(100), '... ArrayRef rejects anything which is not a ArrayRef');
186ok(!defined ArrayRef(''), '... ArrayRef rejects anything which is not a ArrayRef');
187ok(!defined ArrayRef('Foo'), '... ArrayRef rejects anything which is not a ArrayRef');
188ok(defined ArrayRef([]), '... ArrayRef accepts anything which is a ArrayRef');
189ok(!defined ArrayRef({}), '... ArrayRef rejects anything which is not a ArrayRef');
190ok(!defined ArrayRef(sub {}), '... ArrayRef rejects anything which is not a ArrayRef');
191ok(!defined ArrayRef($SCALAR_REF), '... ArrayRef rejects anything which is not a ArrayRef');
3f7376b0 192ok(!defined ArrayRef($GLOB_REF), '... ArrayRef rejects anything which is not a ArrayRef');
0a5bd159 193ok(!defined ArrayRef($fh), '... ArrayRef rejects anything which is not a ArrayRef');
a15dff8d 194ok(!defined ArrayRef(qr/../), '... ArrayRef rejects anything which is not a ArrayRef');
195ok(!defined ArrayRef(bless {}, 'Foo'), '... ArrayRef rejects anything which is not a ArrayRef');
5a4c5493 196ok(!defined ArrayRef(undef), '... ArrayRef rejects anything which is not a ArrayRef');
a15dff8d 197
198ok(!defined HashRef(0), '... HashRef rejects anything which is not a HashRef');
199ok(!defined HashRef(100), '... HashRef rejects anything which is not a HashRef');
200ok(!defined HashRef(''), '... HashRef rejects anything which is not a HashRef');
201ok(!defined HashRef('Foo'), '... HashRef rejects anything which is not a HashRef');
202ok(!defined HashRef([]), '... HashRef rejects anything which is not a HashRef');
203ok(defined HashRef({}), '... HashRef accepts anything which is a HashRef');
204ok(!defined HashRef(sub {}), '... HashRef rejects anything which is not a HashRef');
205ok(!defined HashRef($SCALAR_REF), '... HashRef rejects anything which is not a HashRef');
3f7376b0 206ok(!defined HashRef($GLOB_REF), '... HashRef rejects anything which is not a HashRef');
0a5bd159 207ok(!defined HashRef($fh), '... HashRef rejects anything which is not a HashRef');
a15dff8d 208ok(!defined HashRef(qr/../), '... HashRef rejects anything which is not a HashRef');
209ok(!defined HashRef(bless {}, 'Foo'), '... HashRef rejects anything which is not a HashRef');
5a4c5493 210ok(!defined HashRef(undef), '... HashRef rejects anything which is not a HashRef');
a15dff8d 211
212ok(!defined CodeRef(0), '... CodeRef rejects anything which is not a CodeRef');
213ok(!defined CodeRef(100), '... CodeRef rejects anything which is not a CodeRef');
214ok(!defined CodeRef(''), '... CodeRef rejects anything which is not a CodeRef');
215ok(!defined CodeRef('Foo'), '... CodeRef rejects anything which is not a CodeRef');
216ok(!defined CodeRef([]), '... CodeRef rejects anything which is not a CodeRef');
217ok(!defined CodeRef({}), '... CodeRef rejects anything which is not a CodeRef');
218ok(defined CodeRef(sub {}), '... CodeRef accepts anything which is a CodeRef');
219ok(!defined CodeRef($SCALAR_REF), '... CodeRef rejects anything which is not a CodeRef');
3f7376b0 220ok(!defined CodeRef($GLOB_REF), '... CodeRef rejects anything which is not a CodeRef');
0a5bd159 221ok(!defined CodeRef($fh), '... CodeRef rejects anything which is not a CodeRef');
a15dff8d 222ok(!defined CodeRef(qr/../), '... CodeRef rejects anything which is not a CodeRef');
223ok(!defined CodeRef(bless {}, 'Foo'), '... CodeRef rejects anything which is not a CodeRef');
5a4c5493 224ok(!defined CodeRef(undef), '... CodeRef rejects anything which is not a CodeRef');
a15dff8d 225
226ok(!defined RegexpRef(0), '... RegexpRef rejects anything which is not a RegexpRef');
227ok(!defined RegexpRef(100), '... RegexpRef rejects anything which is not a RegexpRef');
228ok(!defined RegexpRef(''), '... RegexpRef rejects anything which is not a RegexpRef');
229ok(!defined RegexpRef('Foo'), '... RegexpRef rejects anything which is not a RegexpRef');
230ok(!defined RegexpRef([]), '... RegexpRef rejects anything which is not a RegexpRef');
231ok(!defined RegexpRef({}), '... RegexpRef rejects anything which is not a RegexpRef');
232ok(!defined RegexpRef(sub {}), '... RegexpRef rejects anything which is not a RegexpRef');
233ok(!defined RegexpRef($SCALAR_REF), '... RegexpRef rejects anything which is not a RegexpRef');
3f7376b0 234ok(!defined RegexpRef($GLOB_REF), '... RegexpRef rejects anything which is not a RegexpRef');
0a5bd159 235ok(!defined RegexpRef($fh), '... RegexpRef rejects anything which is not a RegexpRef');
a15dff8d 236ok(defined RegexpRef(qr/../), '... RegexpRef accepts anything which is a RegexpRef');
237ok(!defined RegexpRef(bless {}, 'Foo'), '... RegexpRef rejects anything which is not a RegexpRef');
5a4c5493 238ok(!defined RegexpRef(undef), '... RegexpRef rejects anything which is not a RegexpRef');
a15dff8d 239
3f7376b0 240ok(!defined GlobRef(0), '... GlobRef rejects anything which is not a GlobRef');
241ok(!defined GlobRef(100), '... GlobRef rejects anything which is not a GlobRef');
242ok(!defined GlobRef(''), '... GlobRef rejects anything which is not a GlobRef');
243ok(!defined GlobRef('Foo'), '... GlobRef rejects anything which is not a GlobRef');
244ok(!defined GlobRef([]), '... GlobRef rejects anything which is not a GlobRef');
245ok(!defined GlobRef({}), '... GlobRef rejects anything which is not a GlobRef');
246ok(!defined GlobRef(sub {}), '... GlobRef rejects anything which is not a GlobRef');
247ok(!defined GlobRef($SCALAR_REF), '... GlobRef rejects anything which is not a GlobRef');
0a5bd159 248ok(defined GlobRef($GLOB_REF), '... GlobRef accepts anything which is a GlobRef');
249ok(defined GlobRef($fh), '... GlobRef accepts anything which is a GlobRef');
250ok(!defined GlobRef(qr/../), '... GlobRef rejects anything which is not a GlobRef');
3f7376b0 251ok(!defined GlobRef(bless {}, 'Foo'), '... GlobRef rejects anything which is not a GlobRef');
252ok(!defined GlobRef(undef), '... GlobRef rejects anything which is not a GlobRef');
253
0a5bd159 254ok(!defined FileHandle(0), '... FileHandle rejects anything which is not a FileHandle');
255ok(!defined FileHandle(100), '... FileHandle rejects anything which is not a FileHandle');
256ok(!defined FileHandle(''), '... FileHandle rejects anything which is not a FileHandle');
257ok(!defined FileHandle('Foo'), '... FileHandle rejects anything which is not a FileHandle');
258ok(!defined FileHandle([]), '... FileHandle rejects anything which is not a FileHandle');
259ok(!defined FileHandle({}), '... FileHandle rejects anything which is not a FileHandle');
260ok(!defined FileHandle(sub {}), '... FileHandle rejects anything which is not a FileHandle');
261ok(!defined FileHandle($SCALAR_REF), '... FileHandle rejects anything which is not a FileHandle');
262ok(!defined FileHandle($GLOB_REF), '... FileHandle rejects anything which is not a FileHandle');
263ok(defined FileHandle($fh), '... FileHandle accepts anything which is a FileHandle');
264ok(!defined FileHandle(qr/../), '... FileHandle rejects anything which is not a FileHandle');
265ok(!defined FileHandle(bless {}, 'Foo'), '... FileHandle rejects anything which is not a FileHandle');
266ok(!defined FileHandle(undef), '... FileHandle rejects anything which is not a FileHandle');
267
a15dff8d 268ok(!defined Object(0), '... Object rejects anything which is not blessed');
269ok(!defined Object(100), '... Object rejects anything which is not blessed');
270ok(!defined Object(''), '... Object rejects anything which is not blessed');
271ok(!defined Object('Foo'), '... Object rejects anything which is not blessed');
272ok(!defined Object([]), '... Object rejects anything which is not blessed');
273ok(!defined Object({}), '... Object rejects anything which is not blessed');
274ok(!defined Object(sub {}), '... Object rejects anything which is not blessed');
275ok(!defined Object($SCALAR_REF), '... Object rejects anything which is not blessed');
3f7376b0 276ok(!defined Object($GLOB_REF), '... Object rejects anything which is not blessed');
0a5bd159 277ok(!defined Object($fh), '... Object rejects anything which is not blessed');
a15dff8d 278ok(!defined Object(qr/../), '... Object rejects anything which is not blessed');
279ok(defined Object(bless {}, 'Foo'), '... Object accepts anything which is blessed');
5a4c5493 280ok(!defined Object(undef), '... Object accepts anything which is blessed');
02a0fb52 281
282{
283 package My::Role;
284 sub does { 'fake' }
285}
286
5a4c5493 287ok(!defined Role(0), '... Role rejects anything which is not a Role');
288ok(!defined Role(100), '... Role rejects anything which is not a Role');
289ok(!defined Role(''), '... Role rejects anything which is not a Role');
290ok(!defined Role('Foo'), '... Role rejects anything which is not a Role');
291ok(!defined Role([]), '... Role rejects anything which is not a Role');
292ok(!defined Role({}), '... Role rejects anything which is not a Role');
293ok(!defined Role(sub {}), '... Role rejects anything which is not a Role');
294ok(!defined Role($SCALAR_REF), '... Role rejects anything which is not a Role');
3f7376b0 295ok(!defined Role($GLOB_REF), '... Role rejects anything which is not a Role');
0a5bd159 296ok(!defined Role($fh), '... Role rejects anything which is not a Role');
5a4c5493 297ok(!defined Role(qr/../), '... Role rejects anything which is not a Role');
298ok(!defined Role(bless {}, 'Foo'), '... Role accepts anything which is not a Role');
02a0fb52 299ok(defined Role(bless {}, 'My::Role'), '... Role accepts anything which is not a Role');
5a4c5493 300ok(!defined Role(undef), '... Role accepts anything which is not a Role');
02a0fb52 301
9af1d28b 302ok(!defined ClassName(0), '... ClassName rejects anything which is not a ClassName');
303ok(!defined ClassName(100), '... ClassName rejects anything which is not a ClassName');
304ok(!defined ClassName(''), '... ClassName rejects anything which is not a ClassName');
305ok(!defined ClassName('Baz'), '... ClassName rejects anything which is not a ClassName');
306ok(!defined ClassName([]), '... ClassName rejects anything which is not a ClassName');
307ok(!defined ClassName({}), '... ClassName rejects anything which is not a ClassName');
308ok(!defined ClassName(sub {}), '... ClassName rejects anything which is not a ClassName');
309ok(!defined ClassName($SCALAR_REF), '... ClassName rejects anything which is not a ClassName');
310ok(!defined ClassName($fh), '... ClassName rejects anything which is not a ClassName');
311ok(!defined ClassName($GLOB_REF), '... ClassName rejects anything which is not a ClassName');
312ok(!defined ClassName(qr/../), '... ClassName rejects anything which is not a ClassName');
313ok(!defined ClassName(bless {}, 'Foo'), '... ClassName rejects anything which is not a ClassName');
314ok(!defined ClassName(undef), '... ClassName rejects anything which is not a ClassName');
315ok(defined ClassName('UNIVERSAL'), '... ClassName accepts anything which is a ClassName');
316ok(defined ClassName('Moose::Meta::TypeConstraint'), '... ClassName accepts anything which is a ClassName');
317
0a5bd159 318close($fh) || die "Could not close the filehandle $0 for test";