summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_gettext_utf8.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:19 +0000
commita4e9136f68a40b1cb0eb6df5a5f06603224a87f4 (patch)
treeba32e0d0069ad6adfd6b32d05161a03eea5e4c7c /src/testdir/test_gettext_utf8.vim
parentReleasing progress-linux version 2:9.1.0496-1~progress7.99u1. (diff)
downloadvim-a4e9136f68a40b1cb0eb6df5a5f06603224a87f4.tar.xz
vim-a4e9136f68a40b1cb0eb6df5a5f06603224a87f4.zip
Merging upstream version 2:9.1.0698.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_gettext_utf8.vim')
-rw-r--r--src/testdir/test_gettext_utf8.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/testdir/test_gettext_utf8.vim b/src/testdir/test_gettext_utf8.vim
new file mode 100644
index 0000000..b96f8ea
--- /dev/null
+++ b/src/testdir/test_gettext_utf8.vim
@@ -0,0 +1,35 @@
+source check.vim
+" This fail on CI MacOS 14 because bindtextdomain() is not available there
+" (missing library?)
+CheckNotMac
+CheckFeature gettext
+
+" Test for gettext()
+func Test_gettext()
+ set encoding=utf-8
+ call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__"))
+
+ try
+ call assert_true(bindtextdomain("__PACKAGE__", getcwd()))
+
+ try
+ language messages ru_RU
+ call assert_equal('ОШИБКА: ', gettext("ERROR: ", "__PACKAGE__"))
+ catch /^Vim\%((\a\+)\)\=:E197:/
+ throw "Skipped: not possible to set locale to ru (missing?)"
+ endtry
+
+ try
+ language messages en_GB.UTF-8
+ call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__"))
+ catch /^Vim\%((\a\+)\)\=:E197:/
+ throw "Skipped: not possible to set locale to en (missing?)"
+ endtry
+
+ catch /^Vim\%((\a\+)\)\=:E342:/
+ throw "Skipped: out of memory executing bindtextdomain()"
+ endtry
+ set encoding&
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab