File: hash_string_concat.t

package info (click to toggle)
libclass-makemethods-perl 1.01-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,944 kB
  • sloc: perl: 10,495; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (4)
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

package X;

use Test;
BEGIN { plan tests => 13 }

use Class::MakeMethods::Template::Hash (
  'string --get_concat' => 'x',
  'string --get_concat' => {'name' => 'y', 'join' => "\t"},
);

sub new { bless {}, shift; }

my $o = new X;

ok( 1 ); #1
ok( $o->x eq "" ); #2
ok( $o->x('foo') ); #3
ok( $o->x eq 'foo' ); #4
ok( $o->x('bar') ); #5
ok( $o->x eq 'foobar' ); #6
ok( ! defined $o->clear_x ); #7
ok( $o->x eq "" ); #8

ok( $o->y eq "" ); #9
ok( $o->y ('one') ); #10
ok( $o->y eq 'one' ); #11
ok( $o->y ('two') ); #12
ok( $o->y eq "one\ttwo" ); #13

exit 0;