1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#!/usr/bin/perl
# '$Id: 40noparens.t,v 1.1 2005/05/20 01:36:47 ovid Exp $';
use warnings;
use strict;
use Test::More tests => 6;
my $CLASS;
BEGIN
{
chdir 't' if -d 't';
unshift @INC => '../lib';
$CLASS = 'Data::Dumper::Simple';
use_ok($CLASS) or die;
}
my $scalar = 'Ovid';
my @array = qw/Data Dumper Simple Rocks!/;
my %hash = (
at => 'least',
I => 'hope',
it => 'does',
);
my $expected = Data::Dumper->Dump(
[$scalar, \@array, \%hash],
[qw/$scalar *array *hash/]
);
my $got = Dumper $scalar, @array, %hash;
is($got, $expected, 'Having no parens is allowed');
$got = Dumper
$scalar,
@array,
%hash;
is($got, $expected, '... even split among several lines');
$got = Dumper
$scalar =>
@array =>
%hash
;
is($got, $expected, '... or using big arrows, or whitespace before the semicolon');
{
$got = Dumper
$scalar,
@array,
%hash
}
is($got, $expected, '... or at the end of a block (no semicolon)');
$got = Dumper
$hash{I},
$array[3];
$expected = Data::Dumper->Dump(
[$hash{I}, $array[3]],
[qw/$hash{I} $array[3]/]
);
is($got, $expected, '... or with aggregate elements');
|