Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: source/libvpx/examples/includes/HTML-Toc-0.91/t/insert.t

Issue 148913004: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: source/libvpx/examples/includes/HTML-Toc-0.91/t/insert.t
===================================================================
--- source/libvpx/examples/includes/HTML-Toc-0.91/t/insert.t (revision 247498)
+++ source/libvpx/examples/includes/HTML-Toc-0.91/t/insert.t (working copy)
@@ -1,336 +0,0 @@
-#--- insert.t -----------------------------------------------------------------
-# function: Test ToC insertion.
-
-use strict;
-use Test;
-
-BEGIN { plan tests => 10; }
-
-use HTML::Toc;
-use HTML::TocGenerator;
-use HTML::TocInsertor;
-
-my ($output, $content, $filename);
-my $toc = HTML::Toc->new;
-my $tocGenerator = HTML::TocGenerator->new;
-my $tocInsertor = HTML::TocInsertor->new;
-
-$toc->setOptions({
- 'doLinkToToken' => 0,
- 'levelIndent' => 0,
- 'header' => "",
- 'footer' => "",
-});
-
-
-BEGIN {
- # Create test file
- $filename = "file$$.htm";
- die "$filename is already there" if -e $filename;
- open(FILE, ">$filename") || die "Can't create $filename: $!";
- print FILE <<'EOT'; close(FILE);
-<h1>Header</h1>
-EOT
-}
-
-
-END {
- # Remove test file
- unlink($filename) or warn "Can't unlink $filename: $!";
-}
-
-
-#--- 1. insert before start ---------------------------------------------------
-
-$toc->setOptions({'insertionPoint' => 'before <h1>'});
- # Generate ToC
-$tocGenerator->generate($toc, "<h1>Header</h1>");
-$tocInsertor->insert($toc, "<h1>Header</h1>", {
- 'output' => \$output,
- 'doGenerateToc' => 0
-});
- # Test ToC
-ok($output, "<ul>\n<li>Header\n</ul><h1>Header</h1>");
-
-
-#--- 2. insert after start ----------------------------------------------------
-
-$toc->setOptions({'insertionPoint' => 'after <h1>'});
- # Generate ToC
-$tocGenerator->generate($toc, "<h1>Header</h1>");
-$tocInsertor->insert($toc, "<h1>Header</h1>", {
- 'output' => \$output,
- 'doGenerateToc' => 0
-});
- # Test ToC
-ok($output, "<h1><ul>\n<li>Header\n</ul>Header</h1>");
-
-
-#--- 3. insert before end -----------------------------------------------------
-
-$toc->setOptions({'insertionPoint' => 'before </h1>'});
- # Generate ToC
-$tocGenerator->generate($toc, "<h1>Header</h1>");
-$tocInsertor->insert($toc, "<h1>Header</h1>", {
- 'output' => \$output,
- 'doGenerateToc' => 0
-});
- # Test ToC
-ok($output, "<h1>Header<ul>\n<li>Header\n</ul></h1>");
-
-
-#--- 4. insert after end ------------------------------------------------------
-
-$toc->setOptions({'insertionPoint' => 'after </h1>'});
- # Generate ToC
-$tocGenerator->generate($toc, "<h1>Header</h1>");
-$tocInsertor->insert($toc, "<h1>Header</h1>", {
- 'output' => \$output,
- 'doGenerateToc' => 0
-});
- # Test ToC
-ok($output, "<h1>Header</h1><ul>\n<li>Header\n</ul>");
-
-
-#--- 5. outputFile ------------------------------------------------------------
-
-$toc->setOptions({'insertionPoint' => 'before <h1>'});
- # Generate ToC
-$tocGenerator->generate($toc, "<h1>Header</h1>");
- # Insert ToC, output to file
-$tocInsertor->insert($toc, "<h1>Header</h1>", {
- 'outputFile' => $filename,
- 'doGenerateToc' => 0
-});
- # Read outputfile
-open(FILE, "<$filename") || die "Can't open $filename: $!";
-$content = join('', <FILE>);
-close(FILE);
- # Test ToC
-ok($output, "<ul>\n<li>Header\n</ul><h1>Header</h1>");
-
-
-#--- 6. empty toc -------------------------------------------------------------
-
-$tocGenerator->generate($toc, "");
-$tocInsertor->insert($toc, "", {
- 'output' => \$output,
- 'doGenerateToc' => 0
-});
-ok($output, "");
-
-
-#--- TestAfterDeclaration() ---------------------------------------------------
-# function: Test putting HTML comment after declaration.
-
-sub TestAfterDeclaration {
- # Create objects
- my $toc = HTML::Toc->new();
- my $tocInsertor = HTML::TocInsertor->new();
- my $output;
-
- # Set ToC options
- $toc->setOptions({
- 'insertionPoint' => "after <!ToC>",
- });
- # Generate ToC
- $tocInsertor->insert($toc, <<EOT, {'output' => \$output});
-<!ToC><body>
- <h1>Appendix</h1>
- <h2>Appendix Paragraph</h2>
- <h1>Appendix</h1>
- <h2>Appendix Paragraph</h2>
-</body>
-EOT
- # Test ToC
- ok($output, <<EOT);
-<!ToC>
-<!-- Table of Contents generated by Perl - HTML::Toc -->
-<ul>
- <li><a href=#h-1>Appendix</a>
- <ul>
- <li><a href=#h-1.1>Appendix Paragraph</a>
- </ul>
- <li><a href=#h-2>Appendix</a>
- <ul>
- <li><a href=#h-2.1>Appendix Paragraph</a>
- </ul>
-</ul>
-<!-- End of generated Table of Contents -->
-<body>
- <a name=h-1><h1>Appendix</h1></a>
- <a name=h-1.1><h2>Appendix Paragraph</h2></a>
- <a name=h-2><h1>Appendix</h1></a>
- <a name=h-2.1><h2>Appendix Paragraph</h2></a>
-</body>
-EOT
-} # TestAfterDeclaration()
-
-
-#--- TestNumberingStyle() -----------------------------------------------------
-# function: Test numberingstyle.
-
-sub TestNumberingStyle {
- # Create objects
- my $toc = HTML::Toc->new();
- my $tocInsertor = HTML::TocInsertor->new();
- my $output;
-
- # Set ToC options
- $toc->setOptions({
- 'numberingStyle' => 'lower-alpha',
- 'doNumberToken' => 1,
- 'tokenToToc' => [{
- 'tokenBegin' => '<h1>',
- }, {
- 'tokenBegin' => '<h2>',
- 'level' => 2,
- 'numberingStyle' => 'upper-alpha'
- }, {
- 'tokenBegin' => '<h3>',
- 'level' => 3,
- 'numberingStyle' => 'decimal'
- }]
- });
- # Generate ToC
- $tocInsertor->insert($toc, <<EOT, {'output' => \$output});
-<body>
- <h1>Chapter</h1>
- <h2>Paragraph</h2>
- <h3>Paragraph</h3>
- <h3>Paragraph</h3>
- <h3>Paragraph</h3>
-</body>
-EOT
- # Test ToC
- ok($output, <<EOT);
-<body>
-<!-- Table of Contents generated by Perl - HTML::Toc -->
-<ul>
- <li><a href=#h-a>Chapter</a>
- <ul>
- <li><a href=#h-a.A>Paragraph</a>
- <ul>
- <li><a href=#h-a.A.1>Paragraph</a>
- <li><a href=#h-a.A.2>Paragraph</a>
- <li><a href=#h-a.A.3>Paragraph</a>
- </ul>
- </ul>
-</ul>
-<!-- End of generated Table of Contents -->
-
- <a name=h-a><h1>a &nbsp;Chapter</h1></a>
- <a name=h-a.A><h2>a.A &nbsp;Paragraph</h2></a>
- <a name=h-a.A.1><h3>a.A.1 &nbsp;Paragraph</h3></a>
- <a name=h-a.A.2><h3>a.A.2 &nbsp;Paragraph</h3></a>
- <a name=h-a.A.3><h3>a.A.3 &nbsp;Paragraph</h3></a>
-</body>
-EOT
-} # TestNumberingStyle()
-
-
-#--- TestReplaceComment() -----------------------------------------------------
-# function: Test replacing HTML comment with ToC.
-
-sub TestReplaceComment {
- # Create objects
- my $toc = HTML::Toc->new();
- my $tocInsertor = HTML::TocInsertor->new();
- my $output;
-
- # Set ToC options
- $toc->setOptions({
- 'insertionPoint' => "replace <!-- ToC -->"
- });
- # Generate ToC
- $tocInsertor->insert($toc, <<EOT, {'output' => \$output});
-<!-- ToC -->
-<body>
- <h1>Appendix</h1>
- <h2>Appendix Paragraph</h2>
- <h1>Appendix</h1>
- <h2>Appendix Paragraph</h2>
-</body>
-EOT
- # Test ToC
- ok($output, <<EOT);
-
-<!-- Table of Contents generated by Perl - HTML::Toc -->
-<ul>
- <li><a href=#h-1>Appendix</a>
- <ul>
- <li><a href=#h-1.1>Appendix Paragraph</a>
- </ul>
- <li><a href=#h-2>Appendix</a>
- <ul>
- <li><a href=#h-2.1>Appendix Paragraph</a>
- </ul>
-</ul>
-<!-- End of generated Table of Contents -->
-
-<body>
- <a name=h-1><h1>Appendix</h1></a>
- <a name=h-1.1><h2>Appendix Paragraph</h2></a>
- <a name=h-2><h1>Appendix</h1></a>
- <a name=h-2.1><h2>Appendix Paragraph</h2></a>
-</body>
-EOT
-} # TestReplaceComment()
-
-
-#--- TestReplaceText() -----------------------------------------------------
-# function: Test replacing HTML comment with ToC.
-
-sub TestReplaceText {
- # Create objects
- my $toc = HTML::Toc->new();
- my $tocInsertor = HTML::TocInsertor->new();
- my $output;
-
- # Set ToC options
- $toc->setOptions({
- 'insertionPoint' => "replace ToC will be placed here[,]"
- });
- # Generate ToC
- $tocInsertor->insert($toc, <<EOT, {'output' => \$output});
-The ToC will be placed here, overnight.
-<body>
- <h1>Appendix</h1>
- <h2>Appendix Paragraph</h2>
- <h1>Appendix</h1>
- <h2>Appendix Paragraph</h2>
-</body>
-EOT
- # Test ToC
- ok($output, <<EOT);
-
-<!-- Table of Contents generated by Perl - HTML::Toc -->
-<ul>
- <li><a href=#h-1>Appendix</a>
- <ul>
- <li><a href=#h-1.1>Appendix Paragraph</a>
- </ul>
- <li><a href=#h-2>Appendix</a>
- <ul>
- <li><a href=#h-2.1>Appendix Paragraph</a>
- </ul>
-</ul>
-<!-- End of generated Table of Contents -->
-<body>
- <a name=h-1><h1>Appendix</h1></a>
- <a name=h-1.1><h2>Appendix Paragraph</h2></a>
- <a name=h-2><h1>Appendix</h1></a>
- <a name=h-2.1><h2>Appendix Paragraph</h2></a>
-</body>
-EOT
-} # TestReplaceText()
-
-
- # 7. Test 'numberingStyle'
-TestNumberingStyle();
- # 8. Test replace comment
-TestReplaceComment();
- # 9. Test after declaration
-TestAfterDeclaration();
- # 10. Test replace text
-TestReplaceText();

Powered by Google App Engine
This is Rietveld 408576698