File: 15_nolvalue.t

package info (click to toggle)
libgetopt-ex-hashed-perl 1.0601-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 312 kB
  • sloc: perl: 408; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 620 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
use strict;
use warnings;
use Test::More;
use lib './t';
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;

use Getopt::EX::Hashed; {
    Getopt::EX::Hashed->configure(ACCESSOR_LVALUE => 0);
    has say  => ( default => 'Hello', is => 'rw' );
    has dite => ( default => 'Hello', is => 'lv' );
}

my $app = Getopt::EX::Hashed->new() or die;

is($app->say, 'Hello', "Getter");

$app->say('Bonjour');
is($app->say, 'Bonjour', "Setter");

eval { $app->say = 'Ciao' };
isnt($@, '', "Wrong Lvalue Setter");

# undocumented feature
eval { $app->dite = 'Ciao' };
is($app->dite, 'Ciao', "Temporary Lvalue Setter");

done_testing;