aboutsummaryrefslogtreecommitdiff
path: root/tests/test/translation.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-04-12 13:30:32 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-04-21 21:16:45 +0200
commited4281ff072443167c43207c039570126061d23b (patch)
tree3c5c0c73a43935d19cc12bd39036b08b7dd4230b /tests/test/translation.scm
parentAllow tests in subdirs. (diff)
downloadcalp-ed4281ff072443167c43207c039570126061d23b.tar.gz
calp-ed4281ff072443167c43207c039570126061d23b.tar.xz
Add a lot of new unit tests.
Diffstat (limited to 'tests/test/translation.scm')
-rw-r--r--tests/test/translation.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test/translation.scm b/tests/test/translation.scm
new file mode 100644
index 00000000..5fb32ab0
--- /dev/null
+++ b/tests/test/translation.scm
@@ -0,0 +1,15 @@
+(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))