# DBO test skeleton (-*- cperl -*-) use lib './t'; use harness; use DBO::Visitor::RenderHTML; require 't/test-begin.pl'; my @tests = ( { id => 1, col_char => '012345678901234', col_text => 'foo' x 10, col_time1 => '1999-06-15 14:30:56', col_time2 => '1999-06-15 00:00:00', col_integer => -100, col_unsigned => 65536, col_option_unsigned => 0, col_option_char => 'red', expected => <
id 1
col_char 012345678901234
col_text foofoofoofoofoofoofoofoofoofoo
col_time1 1999-06-15 14:30:56
col_time2 1999-06-15 00:00:00
col_integer -100
col_unsigned 65536
col_option_unsigned 0
col_option_char red
END }, { id => 2, col_char => '012345678901234', col_text => q('"="'), col_time1 => '1999-06-15 14:30:56', col_time2 => '1999-06-15 00:00:00', col_integer => -1234, col_unsigned => 65536, col_option_unsigned => 1, col_option_char => 'white', expected => <
id 2
col_char 012345678901234
col_text '"="'
col_time1 1999-06-15 14:30:56
col_time2 1999-06-15 00:00:00
col_integer -1234
col_unsigned 65536
col_option_unsigned 1
col_option_char white
END }, { id => 3, col_char => '', col_text => '', col_time1 => '1999-06-15 14:30:56', col_time2 => '1999-06-15 00:00:00', col_integer => 0, col_unsigned => 0, col_option_unsigned => 0, col_option_char => 'blue', expected => <
id 3
col_char
col_text
col_time1 1999-06-15 14:30:56
col_time2 1999-06-15 00:00:00
col_integer 0
col_unsigned 0
col_option_unsigned 0
col_option_char blue
END }, ); test { my $renderer = DBO::Visitor::RenderHTML->new; foreach my $test (@tests) { $renderer->{record} = $test; my $result = $dbo->apply_to_table("${TABLE}1", $renderer); $result eq $test->{expected} or die "--- Test $test->{id}: expected ---\n$test->{expected}\n--- but found ---\n$result\n---\n"; } }; require 't/test-end.pl';