This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix formatting in perldiag
[perl5.git] / t / op / universal.t
CommitLineData
44a8e56a
PP
1#!./perl
2#
3# check UNIVERSAL
4#
5
6print "1..4\n";
7
8# explicit bless
9
10$a = {};
11bless $a, "Bob";
12if ($a->class eq "Bob") {print "ok 1\n";} else {print "not ok 1\n";}
13
14# bless through a package
15
16package Fred;
17
18$b = {};
19bless $b;
20if ($b->class eq "Fred") {print "ok 2\n";} else {print "not ok 2\n";}
21
22package main;
23
24# same as test 1 and 2, but with other object syntax
25
26# explicit bless
27
28$a = {};
29bless $a, "Bob";
30if (class $a eq "Bob") {print "ok 3\n";} else {print "not ok 3\n";}
31
32# bless through a package
33
34package Fred;
35
36$b = {};
37bless $b;
38if (class $b eq "Fred") {print "ok 4\n";} else {print "not ok 4\n";}