Skip to content

Commit

Permalink
Adding tests of HTML configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
- committed Oct 13, 2012
1 parent 05cc135 commit 69b31b7
Showing 1 changed file with 41 additions and 30 deletions.
71 changes: 41 additions & 30 deletions r2/html/t/cfg_fmt.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,16 @@ sub run_one_test {
);
print {$cfg_fh} ${$config_ref};
close $cfg_fh;
my $output = Marpa::R2::HTML::Test::Util::run_command(
my ($output, $stderr) = Marpa::R2::HTML::Test::Util::run_with_stderr(
File::Spec->catfile( @script_dir, 'marpa_r2_html_fmt' ),
'--no-added-tag',
'--compile=' . $test_config_name,
$html_file_name
);

# unlink $test_config_name, $html_file_name;
unlink $test_config_name, $html_file_name;
Marpa::R2::Test::is( $output, ${$expected_ref}, $test_name );
Marpa::R2::Test::is( $stderr, q{}, "$test_name: stderr");
} ## end sub run_one_test

my $default_config = do {
Expand Down Expand Up @@ -104,32 +105,42 @@ $expected_output = <<'END_OF_EXPECTED_OUTPUT';
END_OF_EXPECTED_OUTPUT
run_one_test( $test_name, $test_html, \$test_config, \$expected_output );

# ELE_acme is a FLO_inline included in GRP_block
#
# <html>
# <head>
# </head>
# <body>
# <acme>
# -during-<span>
# -more inline stuff-</span></acme><p>
# -new block-
# </p></body>
# </html>
#
# ELE_acme is a FLO_mixed included in GRP_block
#
# <html>
# <head>
# </head>
# <body>
# <acme>
# -during-<span>
# -more inline stuff-</span><p>
# -new block-
# </p></acme></body>
# </html>
#
$test_name = 'Inline element containing block flow';
$test_config =
${$default_config} . 'ELE_acme is a FLO_inline included in GRP_block';
# $test_html is same as in previous test
$expected_output = <<'END_OF_EXPECTED_OUTPUT';
<html>
<head>
</head>
<body>
<acme>
-during-<span>
-more inline stuff-</span></acme><p>
-new block-
</p></body>
</html>
END_OF_EXPECTED_OUTPUT
run_one_test( $test_name, $test_html, \$test_config, \$expected_output );

$test_name = 'Block element containing mixed flow';
$test_config =
${$default_config} . 'ELE_acme is a FLO_mixed included in GRP_block';
# $test_html is same as in previous test
$expected_output = <<'END_OF_EXPECTED_OUTPUT';
<html>
<head>
</head>
<body>
<acme>
-during-<span>
-more inline stuff-</span><p>
-new block-
</p></acme></body>
</html>
END_OF_EXPECTED_OUTPUT
run_one_test( $test_name, $test_html, \$test_config, \$expected_output );

# ELE_acme is a FLO_block included in GRP_block
#
# <html>
Expand All @@ -143,7 +154,7 @@ run_one_test( $test_name, $test_html, \$test_config, \$expected_output );
# -new block-
# </p></acme></body>
# </html>
#

# ELE_acme is a FLO_pcdata included in GRP_block
#
# <html>
Expand All @@ -157,7 +168,7 @@ run_one_test( $test_name, $test_html, \$test_config, \$expected_output );
# -new block-
# </p></body>
# </html>
#

# ELE_acme is a FLO_empty included in GRP_block
#
# <html>
Expand Down

0 comments on commit 69b31b7

Please sign in to comment.