summaryrefslogtreecommitdiffstats
path: root/t/gettextize
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/gettextize
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 '')
-rw-r--r--t/gettextize.t39
-rw-r--r--t/gettextize/TEST_OK.md5
-rw-r--r--t/gettextize/test_dups.err0
-rw-r--r--t/gettextize/test_dups.md5
-rw-r--r--t/gettextize/test_dups.po30
-rw-r--r--t/gettextize/test_ok.err0
-rw-r--r--t/gettextize/test_ok.md5
-rw-r--r--t/gettextize/test_ok.po35
8 files changed, 119 insertions, 0 deletions
diff --git a/t/gettextize.t b/t/gettextize.t
new file mode 100644
index 0000000..f490707
--- /dev/null
+++ b/t/gettextize.t
@@ -0,0 +1,39 @@
+#! /usr/bin/perl
+# po4a-gettextize tester.
+
+#########################
+
+use strict;
+use warnings;
+
+use lib q(t);
+use Testhelper;
+
+my @tests;
+
+my $diff_pod_flags = " -I 'This file was generated by po4a' ";
+
+# msginit annoyances, see https://github.com/mquinson/po4a/issues/338
+my $PODIFF =
+ "-I'^\"Project-Id-Version:' -I'^\"POT-Creation-Date:' -I'^\"PO-Revision-Date:' "
+ . "-I'^# [^[:blank:]]* translations for ' -I'^# Language [^[:blank:]]* translations for ' -I'Copyright (C) 20.. Free Software Foundation, Inc.' -I'^# This file is distributed under the same license as the' -I'^# Automatically generated, 20...' ";
+
+$PODIFF .= " -I ^#:";
+
+push @tests,
+ {
+ 'run' =>
+ "cd tmp ; perl ../../po4a-gettextize -f text -o markdown -m ../gettextize/test_ok.md -l ../gettextize/TEST_OK.md -p ./generated.po 2> ./err",
+ 'tests' => [ "diff $PODIFF -u gettextize/test_ok.po tmp/generated.po", "diff -u gettextize/test_ok.err tmp/err" ],
+ 'doc' => "Gettextize a simple file.",
+ },
+ {
+ 'run' =>
+ "cd tmp ; perl ../../po4a-gettextize -f text -o markdown -m ../gettextize/test_dups.md -l ../gettextize/TEST_OK.md -p ./generated.po 2> ./err",
+ 'tests' =>
+ [ "diff $PODIFF -u gettextize/test_dups.po tmp/generated.po", "diff -u gettextize/test_dups.err tmp/err" ],
+ 'doc' => "Gettextize a file with dupplicate entries.",
+ };
+
+run_all_tests(@tests);
+0;
diff --git a/t/gettextize/TEST_OK.md b/t/gettextize/TEST_OK.md
new file mode 100644
index 0000000..3165aa4
--- /dev/null
+++ b/t/gettextize/TEST_OK.md
@@ -0,0 +1,5 @@
+# HELLO
+
+## SUBTITLE
+
+SAMPLE PARAGRAPH. \ No newline at end of file
diff --git a/t/gettextize/test_dups.err b/t/gettextize/test_dups.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/t/gettextize/test_dups.err
diff --git a/t/gettextize/test_dups.md b/t/gettextize/test_dups.md
new file mode 100644
index 0000000..333705f
--- /dev/null
+++ b/t/gettextize/test_dups.md
@@ -0,0 +1,5 @@
+# hello
+
+## hello
+
+hello
diff --git a/t/gettextize/test_dups.po b/t/gettextize/test_dups.po
new file mode 100644
index 0000000..059c751
--- /dev/null
+++ b/t/gettextize/test_dups.po
@@ -0,0 +1,30 @@
+# SOME DESCRIPTIVE TITLE
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2022-07-03 18:58+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. type: Plain text
+#: ../gettextize/test_dups.md:1 ../gettextize/test_dups.md:3
+#: ../gettextize/test_dups.md:5
+#, fuzzy, markdown-text, no-wrap
+msgid "hello"
+msgstr ""
+"#-#-#-#-# ../gettextize/TEST_OK.md:1 (type Title #) #-#-#-#-#\n"
+"HELLO\n"
+"#-#-#-#-# ../gettextize/TEST_OK.md:3 (type: Title ##) #-#-#-#-#\n"
+"SUBTITLE\n"
+"#-#-#-#-# ../gettextize/TEST_OK.md:5 (type: Plain text) #-#-#-#-#\n"
+"SAMPLE PARAGRAPH."
diff --git a/t/gettextize/test_ok.err b/t/gettextize/test_ok.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/t/gettextize/test_ok.err
diff --git a/t/gettextize/test_ok.md b/t/gettextize/test_ok.md
new file mode 100644
index 0000000..93627e1
--- /dev/null
+++ b/t/gettextize/test_ok.md
@@ -0,0 +1,5 @@
+# hello
+
+## subtitle
+
+sample paragraph. \ No newline at end of file
diff --git a/t/gettextize/test_ok.po b/t/gettextize/test_ok.po
new file mode 100644
index 0000000..01bfad1
--- /dev/null
+++ b/t/gettextize/test_ok.po
@@ -0,0 +1,35 @@
+# SOME DESCRIPTIVE TITLE
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2022-07-03 18:24+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. type: Title #
+#: gettextize/test_ok.md:1
+#, fuzzy, markdown-text, no-wrap
+msgid "hello"
+msgstr "HELLO"
+
+#. type: Title ##
+#: gettextize/test_ok.md:3
+#, fuzzy, markdown-text, no-wrap
+msgid "subtitle"
+msgstr "SUBTITLE"
+
+#. type: Plain text
+#: gettextize/test_ok.md:5
+#, fuzzy, markdown-text
+msgid "sample paragraph."
+msgstr "SAMPLE PARAGRAPH."