1# Data::Walk - Traverse Perl data structures.
2# Copyright (C) 2005-2016 Guido Flohr <guido.flohr@cantanea.com>,
3# all rights reserved.
4
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Library General Public License as published
7# by the Free Software Foundation; either version 2, or (at your option)
8# any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13# Library General Public License for more details.
14
15# You should have received a copy of the GNU Library General Public
16# License along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18# USA.
19
20use strict;
21
22use Test;
23use Data::Walk;
24
25BEGIN {
26    plan tests => 6;
27}
28
29my ($data);
30
31$data = {
32    foo => 'bar',
33    baz => 'bazoo',
34};
35bless $data;
36walk { wanted => sub {} }, $data;
37ok ref $data, __PACKAGE__;
38
39$data = [ 0, 1, 2, 3 ];
40bless $data;
41walk { wanted => sub {} }, $data;
42ok ref $data, __PACKAGE__;
43
44$data = {
45    foo => 'bar',
46    baz => 'bazoo',
47};
48walk { wanted => sub {} }, $data;
49ok ref $data, 'HASH';
50ok $data =~ /^HASH\(0x[0-9a-f]+\)$/;
51
52$data = [ 0, 1, 2, 3];
53walk { wanted => sub {} }, $data;
54ok ref $data, 'ARRAY';
55ok $data =~ /^ARRAY\(0x[0-9a-f]+\)$/;
56