summaryrefslogtreecommitdiffstats
path: root/t/fmt-txt-markdown.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 11:26:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 11:26:17 +0000
commit5df6c2aefebe3d2abcc939a88e294876d59f03ca (patch)
tree63fb332a0f21ddb91cb789c80cf64e134d373463 /t/fmt-txt-markdown.t
parentInitial commit. (diff)
downloadpo4a-5df6c2aefebe3d2abcc939a88e294876d59f03ca.tar.xz
po4a-5df6c2aefebe3d2abcc939a88e294876d59f03ca.zip
Adding upstream version 0.72.upstream/0.72
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/fmt-txt-markdown.t')
-rw-r--r--t/fmt-txt-markdown.t84
1 files changed, 84 insertions, 0 deletions
diff --git a/t/fmt-txt-markdown.t b/t/fmt-txt-markdown.t
new file mode 100644
index 0000000..dcc2347
--- /dev/null
+++ b/t/fmt-txt-markdown.t
@@ -0,0 +1,84 @@
+# Text module tester.
+
+#########################
+
+use strict;
+use warnings;
+
+use lib q(t);
+use Testhelper;
+
+my @tests;
+
+# Generic tests
+
+foreach my $t (qw(Basic Rules)) {
+ push @tests, { 'format' => 'text', 'options' => '-o markdown', 'input' => "fmt/txt-markdown/$t.md" };
+}
+
+push @tests,
+ {
+ 'format' => 'text',
+ 'options' => "-o markdown --master-charset UTF-8 --wrap-po=newlines -o neverwrap",
+ 'input' => "fmt/txt-markdown/NoWrap.md",
+ },
+ {
+ 'format' => 'text',
+ 'options' => '-o markdown',
+ 'input' => "fmt/txt-markdown/NestedLists.md",
+ },
+ {
+ 'doc' => "Rewrap output of a Markdown file to the given width",
+ 'format' => 'text',
+ 'options' => '-o markdown -w 40',
+ 'input' => "fmt/txt-markdown/Width.md",
+ 'skip' => { 'updatepo' => 1 }
+ };
+
+# Some tests specific to the Pandoc dialect of Markdown
+# In particular regarding the headers
+
+foreach my $pandoc (
+ qw(HeaderTitle HeaderTitleMultilines HeaderTitleAuthors HeaderTitleDate HeaderOnlyAuthor HeaderTitleMultipleAuthors
+ FencedCodeBlocks)
+ )
+{
+ push @tests, { 'format' => 'text', 'options' => '-o markdown', 'input' => "fmt/txt-markdown/Pandoc$pandoc.md" };
+}
+
+# Some tests around the YAML Front Matter feature
+
+push @tests,
+ {
+ 'format' => 'text',
+ 'options' => '-o markdown',
+ 'input' => 'fmt/txt-markdown/YamlFrontMatter.md'
+ },
+ {
+ 'doc' => "That the yfm_keys and yfm_skip_array options actually work",
+ 'format' => 'text',
+ 'options' => "-o markdown -o yfm_skip_array -o yfm_keys='title , subtitle,paragraph'",
+ 'input' => "fmt/txt-markdown/YamlFrontMatter_Options.md",
+ },
+ {
+ 'doc' => "That the yfm_keys and yfm_paths options actually work",
+ 'format' => 'text',
+ 'options' => "-o markdown -o yfm_skip_array -o yfm_keys=' subtitle ,paragraph' -o yfm_paths='people title' ",
+ 'input' => "fmt/txt-markdown/YamlFrontMatter_KeysPaths.md",
+ },
+ {
+ 'doc' => "Allow markdown files to contain two horizontal rulers that do not denote a YFM.",
+ 'format' => 'text',
+ 'options' => "-o markdown -o yfm_lenient ",
+ 'input' => "fmt/txt-markdown/YamlFrontMatter_fake.md",
+ },
+ {
+ 'doc' => "Handle tables in markdown files, even if it's a GitHub extension.",
+ 'skip' => { 'updatepo' => 1 },
+ 'format' => 'text',
+ 'options' => "-o markdown ",
+ 'input' => "fmt/txt-markdown/Tables.md",
+ };
+
+run_all_tests(@tests);
+0;