File: 12-object.t

package info (click to toggle)
libtext-recordparser-perl 1.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 364 kB
  • ctags: 34
  • sloc: perl: 2,045; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (5)
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
#!perl

use strict;
use Config;
use File::Spec::Functions;
use FindBin qw( $Bin );
use Readonly;
use Test::Exception;
use Test::More tests => 6;
use Text::RecordParser;

Readonly my $TEST_DATA_DIR => catdir( $Bin, 'data' );

require_ok 'Text::RecordParser::Object';

my $file = catfile( $TEST_DATA_DIR, 'simpsons.csv' );
my $p    = Text::RecordParser->new( $file );
my $r;
ok( $r = $p->fetchrow_object, 'Got object' );
isa_ok( $r, 'Text::RecordParser::Object', 'Correct class' );
ok( $r->can('Address') && 1, 'Has the "Address" method' );
is( $r->Address, '747 Evergreen Terrace', "Address is good");
throws_ok { $r->Address('900 Oakhill Circle') } 
    qr/cannot alter/,
    "Method is read-only";