[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] tests: i18n: Add more unit tests
From: Dag Andersen <danders () get2net ! dk>
Date: 2016-12-01 11:08:16
Message-ID: E1cCPDs-0004hX-8g () code ! kde ! org
[Download RAW message or body]
Git commit 900da42aa4930fdcb67922874c1f332774cee000 by Dag Andersen.
Committed on 01/12/2016 at 10:52.
Pushed by danders into branch 'master'.
i18n: Add more unit tests
Think I have covered things used in calligra, but should cover more of course.
TODO: Fix calligra_sheets.sh
M +16 -1 tests/CMakeLists.txt
C +0 -33 tests/parameters.sh [from: tests/test_i18n.sh - 053% similarity]
M +11 -25 tests/test_i18n.sh
A +1 -0 tests/test_i18n_noop.cpp [License: Trivial file]
A +40 -0 tests/test_i18n_noop.sh
A +1 -0 tests/test_i18n_noop2.cpp [License: Trivial file]
A +40 -0 tests/test_i18n_noop2.sh
A +1 -0 tests/test_i18nc.cpp [License: Trivial file]
A +40 -0 tests/test_i18nc.sh
A +1 -0 tests/test_i18nc_long.cpp [License: UNKNOWN] *
A +40 -0 tests/test_i18nc_long.sh
M +10 -24 tests/test_kundo2_i18n.sh
A +1 -0 tests/test_kundo2_i18nc.cpp [License: Trivial file]
A +40 -0 tests/test_kundo2_i18nc.sh
M +8 -22 tests/test_kundo2_i18nc_long.sh
A +1 -0 tests/test_xi18n.cpp [License: Trivial file]
A +40 -0 tests/test_xi18n.sh
A +1 -0 tests/test_xi18nc.cpp [License: Trivial file]
A +40 -0 tests/test_xi18nc.sh
A +1 -0 tests/test_xi18nc_long.cpp [License: UNKNOWN] *
A +40 -0 tests/test_xi18nc_long.sh
A +1 -0 tests/test_xi18ncp.cpp [License: Trivial file]
A +40 -0 tests/test_xi18ncp.sh
A +1 -0 tests/test_xi18np.cpp [License: Trivial file]
A +40 -0 tests/test_xi18np.sh
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
https://commits.kde.org/calligra/900da42aa4930fdcb67922874c1f332774cee000
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1e7c77d..7b8b6f4 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -21,10 +21,25 @@ if (BASH_PROGRAM AND XGETTEXT_PROGRAM AND MSGCAT_PROGRAM)
add_custom_target(podir ALL
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/po
COMMENT "Create podir" VERBATIM)
+ # copy parameters script
+ add_custom_target(parameters ALL
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/parameters.sh \
${CMAKE_CURRENT_BINARY_DIR}/parameters.sh + COMMENT "Copy parameters script" \
VERBATIM)
# add tests here
CALLIGRA_ADD_UNIT_TEST(test_i18n)
+ CALLIGRA_ADD_UNIT_TEST(test_i18nc)
+ CALLIGRA_ADD_UNIT_TEST(test_i18nc_long)
+ CALLIGRA_ADD_UNIT_TEST(test_i18n_noop)
+ CALLIGRA_ADD_UNIT_TEST(test_i18n_noop2)
+
+ CALLIGRA_ADD_UNIT_TEST(test_xi18n)
+ CALLIGRA_ADD_UNIT_TEST(test_xi18nc)
+ CALLIGRA_ADD_UNIT_TEST(test_xi18nc_long)
+ CALLIGRA_ADD_UNIT_TEST(test_xi18np)
+ CALLIGRA_ADD_UNIT_TEST(test_xi18ncp)
+
CALLIGRA_ADD_UNIT_TEST(test_kundo2_i18n)
+ CALLIGRA_ADD_UNIT_TEST(test_kundo2_i18nc)
CALLIGRA_ADD_UNIT_TEST(test_kundo2_i18nc_long)
-
endif()
diff --git a/tests/test_i18n.sh b/tests/parameters.sh
similarity index 53%
copy from tests/test_i18n.sh
copy to tests/parameters.sh
index 24912dd..e01bbfa 100644
--- a/tests/test_i18n.sh
+++ b/tests/parameters.sh
@@ -1,17 +1,4 @@
#! /bin/sh
-# test_kundo2_i18nc_long:
-# $1: calligra_xgettext.sh
-# $2: xgettext
-# $3: msgcat
-# $4: podir
-
-# source the calligra_xgettext.sh script
-. $1
-
-# setup environment variables for calligra_xgettext.sh
-XGETTEXT_PROGRAM=$2
-MSGCAT=$3
-podir=$4
# copy from extract-messages.sh
XGETTEXT_FLAGS="\
@@ -32,23 +19,3 @@ XGETTEXT_FLAGS="\
-kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 \
-ktr2i18n:1 -ktr2xi18n:1 \
"
-
-# calligra_xgettext.sh wants this in one variable
-XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
-
-potfile="test_i18n.pot"
-cppfile=test_i18n.cpp
-
-calligra_xgettext $potfile $cppfile
-
-# check result
-if test ! -e $podir/$potfile; then
- echo "FAIL: pot file not created"
- exit 2
-fi
-if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
- echo "FAIL: to many qtundo-format strings"
- exit 1
-fi
-
-exit 0
diff --git a/tests/test_i18n.sh b/tests/test_i18n.sh
index 24912dd..b989bcb 100644
--- a/tests/test_i18n.sh
+++ b/tests/test_i18n.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# test_kundo2_i18nc_long:
+# test_i18n:
# $1: calligra_xgettext.sh
# $2: xgettext
# $3: msgcat
@@ -13,42 +13,28 @@ XGETTEXT_PROGRAM=$2
MSGCAT=$3
podir=$4
-# copy from extract-messages.sh
-XGETTEXT_FLAGS="\
---copyright-holder=This_file_is_part_of_KDE \
---msgid-bugs-address=http://bugs.kde.org \
---from-code=UTF-8 \
--C --kde \
--ci18n \
--ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 \
--ki18nd:2 -ki18ndc:2c,3 -ki18ndp:2,3 -ki18ndcp:2c,3,4 \
--kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
--kki18nd:2 -kki18ndc:2c,3 -kki18ndp:2,3 -kki18ndcp:2c,3,4 \
--kxi18n:1 -kxi18nc:1c,2 -kxi18np:1,2 -kxi18ncp:1c,2,3 \
--kxi18nd:2 -kxi18ndc:2c,3 -kxi18ndp:2,3 -kxi18ndcp:2c,3,4 \
--kkxi18n:1 -kkxi18nc:1c,2 -kkxi18np:1,2 -kkxi18ncp:1c,2,3 \
--kkxi18nd:2 -kkxi18ndc:2c,3 -kkxi18ndp:2,3 -kkxi18ndcp:2c,3,4 \
--kI18N_NOOP:1 -kI18NC_NOOP:1c,2 \
--kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 \
--ktr2i18n:1 -ktr2xi18n:1 \
-"
-
+# get common parameters
+. parameters.sh
# calligra_xgettext.sh wants this in one variable
XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
potfile="test_i18n.pot"
-cppfile=test_i18n.cpp
+cppfile="test_i18n.cpp"
calligra_xgettext $potfile $cppfile
# check result
if test ! -e $podir/$potfile; then
echo "FAIL: pot file not created"
- exit 2
+ exit 1
fi
if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
- echo "FAIL: to many qtundo-format strings"
- exit 1
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
fi
exit 0
diff --git a/tests/test_i18n_noop.cpp b/tests/test_i18n_noop.cpp
new file mode 100644
index 0000000..2dd3352
--- /dev/null
+++ b/tests/test_i18n_noop.cpp
@@ -0,0 +1 @@
+I18N_NOOP("I18N_NOOP");
diff --git a/tests/test_i18n_noop.sh b/tests/test_i18n_noop.sh
new file mode 100644
index 0000000..c35ffad
--- /dev/null
+++ b/tests/test_i18n_noop.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_i18n_noop:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_i18n_noop.pot"
+cppfile="test_i18n_noop.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_i18n_noop2.cpp b/tests/test_i18n_noop2.cpp
new file mode 100644
index 0000000..6e2004a
--- /dev/null
+++ b/tests/test_i18n_noop2.cpp
@@ -0,0 +1 @@
+I18N_NOOP2("I18N_NOOP2 context", "I18N_NOOP2 text");
diff --git a/tests/test_i18n_noop2.sh b/tests/test_i18n_noop2.sh
new file mode 100644
index 0000000..f483d5e
--- /dev/null
+++ b/tests/test_i18n_noop2.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_i18n_noop2:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_i18n_noop2.pot"
+cppfile="test_i18n_noop2.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_i18nc.cpp b/tests/test_i18nc.cpp
new file mode 100644
index 0000000..0072e20
--- /dev/null
+++ b/tests/test_i18nc.cpp
@@ -0,0 +1 @@
+i18nc("@info:tooltip", "normal i18nc");
diff --git a/tests/test_i18nc.sh b/tests/test_i18nc.sh
new file mode 100644
index 0000000..eadbacd
--- /dev/null
+++ b/tests/test_i18nc.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_i18nc:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_i18nc.pot"
+cppfile="test_i18nc.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_i18nc_long.cpp b/tests/test_i18nc_long.cpp
new file mode 100644
index 0000000..3ff4c99
--- /dev/null
+++ b/tests/test_i18nc_long.cpp
@@ -0,0 +1 @@
+i18nc("This is a long kundo2_i18nc context string. It should be so long it is put on \
separate line from the 'msgctxt' by xgettext.", "long i18nc");
diff --git a/tests/test_i18nc_long.sh b/tests/test_i18nc_long.sh
new file mode 100644
index 0000000..056bc9f
--- /dev/null
+++ b/tests/test_i18nc_long.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_i18nc_long:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_i18nc_long.pot"
+cppfile="test_i18nc_long.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_kundo2_i18n.sh b/tests/test_kundo2_i18n.sh
index db44853..65413af 100644
--- a/tests/test_kundo2_i18n.sh
+++ b/tests/test_kundo2_i18n.sh
@@ -13,42 +13,28 @@ XGETTEXT_PROGRAM=$2
MSGCAT=$3
podir=$4
-# copy from extract-messages.sh
-XGETTEXT_FLAGS="\
---copyright-holder=This_file_is_part_of_KDE \
---msgid-bugs-address=http://bugs.kde.org \
---from-code=UTF-8 \
--C --kde \
--ci18n \
--ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 \
--ki18nd:2 -ki18ndc:2c,3 -ki18ndp:2,3 -ki18ndcp:2c,3,4 \
--kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
--kki18nd:2 -kki18ndc:2c,3 -kki18ndp:2,3 -kki18ndcp:2c,3,4 \
--kxi18n:1 -kxi18nc:1c,2 -kxi18np:1,2 -kxi18ncp:1c,2,3 \
--kxi18nd:2 -kxi18ndc:2c,3 -kxi18ndp:2,3 -kxi18ndcp:2c,3,4 \
--kkxi18n:1 -kkxi18nc:1c,2 -kkxi18np:1,2 -kkxi18ncp:1c,2,3 \
--kkxi18nd:2 -kkxi18ndc:2c,3 -kkxi18ndp:2,3 -kkxi18ndcp:2c,3,4 \
--kI18N_NOOP:1 -kI18NC_NOOP:1c,2 \
--kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 \
--ktr2i18n:1 -ktr2xi18n:1 \
-"
-
+# get common parameters
+. parameters.sh
# calligra_xgettext.sh wants this in one variable
XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
potfile="test_kundo2_i18n.pot"
-cppfile=test_kundo2_i18n.cpp
+cppfile="test_kundo2_i18n.cpp"
calligra_xgettext $potfile $cppfile
# check result
if test ! -e $podir/$potfile; then
echo "FAIL: pot file not created"
- exit 2
+ exit 1
fi
if test 1 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
- echo "FAIL: to many qtundo-format strings"
- exit 1
+ echo "FAIL: there should be 1 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings strings"
+ exit 3
fi
exit 0
diff --git a/tests/test_kundo2_i18nc.cpp b/tests/test_kundo2_i18nc.cpp
new file mode 100644
index 0000000..9fd6d57
--- /dev/null
+++ b/tests/test_kundo2_i18nc.cpp
@@ -0,0 +1 @@
+kundo2_i18nc("kundo2 i18nc context", "normal kundo2 i18nc");
diff --git a/tests/test_kundo2_i18nc.sh b/tests/test_kundo2_i18nc.sh
new file mode 100644
index 0000000..935437d
--- /dev/null
+++ b/tests/test_kundo2_i18nc.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_kundo2_i18nc:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_kundo2_i18nc.pot"
+cppfile="test_kundo2_i18nc.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 1 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 1 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_kundo2_i18nc_long.sh b/tests/test_kundo2_i18nc_long.sh
index 4eb2165..e040362 100644
--- a/tests/test_kundo2_i18nc_long.sh
+++ b/tests/test_kundo2_i18nc_long.sh
@@ -13,31 +13,13 @@ XGETTEXT_PROGRAM=$2
MSGCAT=$3
podir=$4
-# copy from extract-messages.sh
-XGETTEXT_FLAGS="\
---copyright-holder=This_file_is_part_of_KDE \
---msgid-bugs-address=http://bugs.kde.org \
---from-code=UTF-8 \
--C --kde \
--ci18n \
--ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 \
--ki18nd:2 -ki18ndc:2c,3 -ki18ndp:2,3 -ki18ndcp:2c,3,4 \
--kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \
--kki18nd:2 -kki18ndc:2c,3 -kki18ndp:2,3 -kki18ndcp:2c,3,4 \
--kxi18n:1 -kxi18nc:1c,2 -kxi18np:1,2 -kxi18ncp:1c,2,3 \
--kxi18nd:2 -kxi18ndc:2c,3 -kxi18ndp:2,3 -kxi18ndcp:2c,3,4 \
--kkxi18n:1 -kkxi18nc:1c,2 -kkxi18np:1,2 -kkxi18ncp:1c,2,3 \
--kkxi18nd:2 -kkxi18ndc:2c,3 -kkxi18ndp:2,3 -kkxi18ndcp:2c,3,4 \
--kI18N_NOOP:1 -kI18NC_NOOP:1c,2 \
--kI18N_NOOP2:1c,2 -kI18N_NOOP2_NOSTRIP:1c,2 \
--ktr2i18n:1 -ktr2xi18n:1 \
-"
-
+# get common parameters
+. parameters.sh
# calligra_xgettext.sh wants this in one variable
XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
potfile="test_kundo2_i18nc_long.pot"
-cppfile=test_kundo2_i18nc_long.cpp
+cppfile="test_kundo2_i18nc_long.cpp"
calligra_xgettext $potfile $cppfile
@@ -47,7 +29,11 @@ if test ! -e $podir/$potfile; then
exit 2
fi
if test 1 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
- echo "FAIL: to many qtundo-format strings"
+ echo "FAIL: there should be 1 qtundo-format strings"
+ exit 1
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
exit 1
fi
diff --git a/tests/test_xi18n.cpp b/tests/test_xi18n.cpp
new file mode 100644
index 0000000..f305463
--- /dev/null
+++ b/tests/test_xi18n.cpp
@@ -0,0 +1 @@
+xi18n("normal xi18n");
diff --git a/tests/test_xi18n.sh b/tests/test_xi18n.sh
new file mode 100644
index 0000000..bd13ad3
--- /dev/null
+++ b/tests/test_xi18n.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_xi18n:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_xi18n.pot"
+cppfile="test_xi18n.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_xi18nc.cpp b/tests/test_xi18nc.cpp
new file mode 100644
index 0000000..8e7ccef
--- /dev/null
+++ b/tests/test_xi18nc.cpp
@@ -0,0 +1 @@
+xi18nc("@info:tooltip", "normal xi18nc");
diff --git a/tests/test_xi18nc.sh b/tests/test_xi18nc.sh
new file mode 100644
index 0000000..1216418
--- /dev/null
+++ b/tests/test_xi18nc.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_xi18nc:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_xi18nc.pot"
+cppfile="test_xi18nc.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_xi18nc_long.cpp b/tests/test_xi18nc_long.cpp
new file mode 100644
index 0000000..37446f7
--- /dev/null
+++ b/tests/test_xi18nc_long.cpp
@@ -0,0 +1 @@
+xi18nc("This is a long kundo2_i18nc context string. It should be so long it is put \
on separate line from the 'msgctxt' by xgettext.", "long i18nc");
diff --git a/tests/test_xi18nc_long.sh b/tests/test_xi18nc_long.sh
new file mode 100644
index 0000000..a903a91
--- /dev/null
+++ b/tests/test_xi18nc_long.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_xi18nc_long:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_xi18nc_long.pot"
+cppfile="test_xi18nc_long.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_xi18ncp.cpp b/tests/test_xi18ncp.cpp
new file mode 100644
index 0000000..2e78d5e
--- /dev/null
+++ b/tests/test_xi18ncp.cpp
@@ -0,0 +1 @@
+xi18ncp("@info context", "xi18ncp singular", "xi18ncp plural %1", 2);
diff --git a/tests/test_xi18ncp.sh b/tests/test_xi18ncp.sh
new file mode 100644
index 0000000..2aefb9b
--- /dev/null
+++ b/tests/test_xi18ncp.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_xi18ncp:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_xi18ncp.pot"
+cppfile="test_xi18ncp.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
diff --git a/tests/test_xi18np.cpp b/tests/test_xi18np.cpp
new file mode 100644
index 0000000..4b67188
--- /dev/null
+++ b/tests/test_xi18np.cpp
@@ -0,0 +1 @@
+xI18np("xI18np singular", "xI18np plural", 2);
diff --git a/tests/test_xi18np.sh b/tests/test_xi18np.sh
new file mode 100644
index 0000000..245edbc
--- /dev/null
+++ b/tests/test_xi18np.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# test_xi18np:
+# $1: calligra_xgettext.sh
+# $2: xgettext
+# $3: msgcat
+# $4: podir
+
+# source the calligra_xgettext.sh script
+. $1
+
+# setup environment variables for calligra_xgettext.sh
+XGETTEXT_PROGRAM=$2
+MSGCAT=$3
+podir=$4
+
+# get common parameters
+. parameters.sh
+# calligra_xgettext.sh wants this in one variable
+XGETTEXT="$XGETTEXT_PROGRAM $XGETTEXT_FLAGS"
+
+potfile="test_xi18np.pot"
+cppfile="test_xi18np.cpp"
+
+calligra_xgettext $potfile $cppfile
+
+# check result
+if test ! -e $podir/$potfile; then
+ echo "FAIL: pot file not created"
+ exit 1
+fi
+if test 0 -ne `grep qtundo-format $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 0 qtundo-format strings"
+ exit 2
+fi
+if test 2 -ne `grep msgid $podir/$potfile|wc -l`; then
+ echo "FAIL: there should be 2 message strings"
+ exit 3
+fi
+
+exit 0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic