1#!./perl
2
3BEGIN {
4    unless (-d 'blib') {
5	chdir 't' if -d 't';
6	@INC = '../lib';
7	require Config; import Config;
8	keys %Config; # Silence warning
9	if ($Config{extensions} !~ /\bList\/Util\b/) {
10	    print "1..0 # Skip: List::Util was not built\n";
11	    exit 0;
12	}
13    }
14}
15use strict;
16use Scalar::Util qw(blessed reftype refaddr);
17use Test::More tests => 6;
18
19my $getmagic_count;
20
21{
22    package T;
23    use Tie::Scalar;
24    use base qw(Tie::StdScalar);
25
26    sub FETCH {
27        $getmagic_count++;
28        my($self) = @_;
29        return $self->SUPER::FETCH;
30    }
31}
32
33tie my $var, 'T';
34
35$var = bless {};
36
37$getmagic_count = 0;
38ok blessed($var);
39is $getmagic_count, 1, 'blessed';
40
41$getmagic_count = 0;
42ok reftype($var);
43is $getmagic_count, 1, 'reftype';
44
45$getmagic_count = 0;
46ok refaddr($var);
47is $getmagic_count, 1, 'refaddr';
48