Move the require './test.pl' to the end of t/comp/hints.t
[p5sagit/p5-mst-13.2.git] / t / op / upgrade.t
CommitLineData
c975a425 1#!./perl -w
2
3# Check that we can "upgrade" from anything to anything else.
4# Curiously, before this, lib/Math/Trig.t was the only code anywhere in the
5# build or testsuite that upgraded an NV to an RV
6
7BEGIN {
8 chdir 't';
9 @INC = '../lib';
10 require './test.pl';
11}
12
13use strict;
14
15my $null;
16
17$! = 1;
18my %types = (
19 null => $null,
20 iv => 3,
21 nv => .5,
22 rv => [],
23 pv => "Perl rules",
24 pviv => 3,
25 pvnv => 1==1,
26 pvmg => $^,
27);
28
29# This is somewhat cheating but I can't think of anything built in that I can
30# copy that already has type PVIV
31$types{pviv} = "Perl rules!";
32
33# use Devel::Peek; Dump $pvmg;
34
35my @keys = keys %types;
36plan tests => @keys * @keys;
37
38foreach my $source_type (@keys) {
39 foreach my $dest_type (@keys) {
40 # Pads re-using variables might contaminate this
41 my $vars = {};
42 $vars->{dest} = $types{$dest_type};
43 $vars->{source} = $types{$source_type};
649a2d69 44 # The assignment can potentially trigger assertion failures, so it's
45 # useful to have the diagnostics about what was attempted printed first
46 print "# Assigning $source_type to $dest_type\n";
c975a425 47 $vars->{dest} = $vars->{source};
48 is ($vars->{dest}, $vars->{source});
49 }
50}