File: hash.t

package info (click to toggle)
libdata-dump-perl 1.25-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 188 kB
  • sloc: perl: 1,173; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 835 bytes parent folder | download | duplicates (6)
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
#!perl -w

use strict;
use Test;
plan tests => 9;

use Data::Dump qw(dump);

my $DOTS = "." x 20;

ok(dump({}), "{}");
ok(dump({ a => 1}), "{ a => 1 }");
ok(dump({ 1 => 1}), "{ 1 => 1 }");
ok(dump({strict => 1, shift => 2, abc => 3, -f => 4 }),
    "{ -f => 4, abc => 3, shift => 2, strict => 1 }");
ok(dump({supercalifragilisticexpialidocious => 1, a => 2}),
    "{ a => 2, supercalifragilisticexpialidocious => 1 }");
ok(dump({supercalifragilisticexpialidocious => 1, a => 2, b => $DOTS})."\n", <<EOT);
{
  a => 2,
  b => "$DOTS",
  supercalifragilisticexpialidocious => 1,
}
EOT
ok(dump({aa => 1, B => 2}), "{ aa => 1, B => 2 }");
ok(dump({a => 1, bar => $DOTS, baz => $DOTS, foo => 2 })."\n", <<EOT);
{
  a   => 1,
  bar => "$DOTS",
  baz => "$DOTS",
  foo => 2,
}
EOT
ok(dump({a => 1, "b-z" => 2}), qq({ "a" => 1, "b-z" => 2 }));