Commit | Line | Data |
4f30591b |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use Test::More; |
6 | use SQL::Abstract; |
7 | |
8 | plan tests => 13; |
9 | |
10 | my $obj = bless {}, "Foo::Bar"; |
11 | |
12 | is(SQL::Abstract->_refkind(undef), 'UNDEF', 'UNDEF'); |
13 | |
14 | is(SQL::Abstract->_refkind({}), 'HASHREF', 'HASHREF'); |
15 | is(SQL::Abstract->_refkind([]), 'ARRAYREF', 'ARRAYREF'); |
16 | |
17 | is(SQL::Abstract->_refkind(\{}), 'HASHREFREF', 'HASHREFREF'); |
18 | is(SQL::Abstract->_refkind(\[]), 'ARRAYREFREF', 'ARRAYREFREF'); |
19 | |
20 | is(SQL::Abstract->_refkind(\\{}), 'HASHREFREFREF', 'HASHREFREFREF'); |
21 | is(SQL::Abstract->_refkind(\\[]), 'ARRAYREFREFREF', 'ARRAYREFREFREF'); |
22 | |
23 | is(SQL::Abstract->_refkind("foo"), 'SCALAR', 'SCALAR'); |
24 | is(SQL::Abstract->_refkind(\"foo"), 'SCALARREF', 'SCALARREF'); |
25 | is(SQL::Abstract->_refkind(\\"foo"), 'SCALARREFREF', 'SCALARREFREF'); |
26 | |
27 | # objects are treated like scalars |
28 | is(SQL::Abstract->_refkind($obj), 'SCALAR', 'SCALAR'); |
29 | is(SQL::Abstract->_refkind(\$obj), 'SCALARREF', 'SCALARREF'); |
30 | is(SQL::Abstract->_refkind(\\$obj), 'SCALARREFREF', 'SCALARREFREF'); |
31 | |