aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/calp
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-24 18:11:41 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-24 18:11:41 +0200
commitc926abbd4720c901c4f944cb158b32460efabb48 (patch)
treef047ec110d99cbadb47e675036dc589c31bd2c5d /tests/unit/calp
parentAdd tests for (calp) module. (diff)
downloadcalp-c926abbd4720c901c4f944cb158b32460efabb48.tar.gz
calp-c926abbd4720c901c4f944cb158b32460efabb48.tar.xz
Add tests for (calp translation).
Diffstat (limited to 'tests/unit/calp')
-rw-r--r--tests/unit/calp/translation.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/calp/translation.scm b/tests/unit/calp/translation.scm
new file mode 100644
index 00000000..9ef55830
--- /dev/null
+++ b/tests/unit/calp/translation.scm
@@ -0,0 +1,17 @@
+(define-module (test translation)
+ :use-module (srfi srfi-64)
+ :use-module (srfi srfi-88)
+ :use-module (calp translation)
+ :use-module (ice-9 i18n))
+
+(define sv (make-locale (list LC_CTYPE LC_MESSAGES) "sv_SE.UTF-8"))
+
+;; empty key should give us translation header
+;; this also tests that translations are properly loaded
+(test-assert "translations" (string? (translate "")))
+
+(test-equal "yes-no yes" 'yes (yes-no-check "y" sv))
+(test-equal "yes-no no" 'no (yes-no-check "n" sv))
+(test-equal "yes-no invalid" #f (yes-no-check "other" sv))
+
+'((calp translation))