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