Debian Codegraph @

cpan/CPAN-Meta-YAML/t/20_subclass.t

raw
1 # Testing documents that should fail
2 use strict;
3 use warnings;
4 use lib 't/lib/';
5 use Test::More 0.88;
6 use TestUtils;
7
8 use File::Spec::Functions ':ALL';
9
10
11
12 #####################################################################
13 # Customized Class
14
15 SCOPE: {
16 package Foo;
17
18 use CPAN::Meta::YAML;
19
20 use vars qw{@ISA};
21 BEGIN {
22 @ISA = 'CPAN::Meta::YAML';
23 }
24
25 # XXX-INGY subclasses should not use private methods… or if they
26 # do they should expect method name changes.
27 # sub _write_scalar {
28
29 sub _dump_scalar {
30 my $self = shift;
31 my $string = shift;
32 my $is_key = shift;
33 if ( defined $is_key ) {
34 return scalar reverse $string;
35 } else {
36 return $string;
37 }
38 }
39
40 1;
41 }
42
43
44
45
46
47 #####################################################################
48 # Generate the value
49
50 my $object = Foo->new(
51 { foo => 'bar' }
52 );
53 is( $object->write_string, "---\noof: bar\n", 'Subclassing works' );
54
55 done_testing;