File: 10data-dump.t

package info (click to toggle)
libstruct-dumb-perl 0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 160 kB
  • sloc: perl: 468; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 571 bytes parent folder | download
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
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

BEGIN {
   plan skip_all => "No Data::Dump" unless eval { require Data::Dump; };

   Data::Dump->import( 'pp' );
}
use Struct::Dumb;

struct Point => [qw( x y )];

{
   my $point = Point( 10, 20 );

   is( pp( $point ),
      'main::Point(10, 20)',
      'Data::Dump::pp can dump a Point' );
}

struct PointX => [qw( x y )], named_constructor => 1;

{
   is( pp( PointX( x => 30, y => 40 ) ),
      'main::PointX(x => 30, y => 40)',
      'Data::Dump::pp dumps named constructors with names' );
}

done_testing;