blob: 9c30e091ef010b2d3e14e5961b6d209b799e18f1 [file] [log] [blame]
Christ van Willegence0ef912024-06-20 23:41:59 +02001source check.vim
RestorerZ96509102024-07-11 21:14:15 +02002" This fail on CI MacOS 14 because bindtextdomain() is not available there
3" (missing library?)
Christian Brabandt6bc11c02024-06-21 07:31:04 +02004CheckNotMac
Christ van Willegen8252ef12024-07-11 21:36:21 +02005CheckFeature gettext
Christ van Willegence0ef912024-06-20 23:41:59 +02006
7" Test for gettext()
8func Test_gettext()
9 set encoding=cp1251
Christ van Willegen8252ef12024-07-11 21:36:21 +020010 call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__"))
11
Christ van Willegence0ef912024-06-20 23:41:59 +020012 try
Christ van Willegen8252ef12024-07-11 21:36:21 +020013 call assert_true(bindtextdomain("__PACKAGE__", getcwd()))
14
15 try
16 language messages ru_RU
Christ van Willegenc0786752025-02-01 15:42:16 +010017 call assert_equal('ÎØÈÁÊÀ: for __PACKAGE__', gettext("ERROR: ", "__PACKAGE__"))
Christ van Willegen8252ef12024-07-11 21:36:21 +020018 catch /^Vim\%((\a\+)\)\=:E197:/
19 throw "Skipped: not possible to set locale to ru (missing?)"
20 endtry
21
22 try
23 language messages en_GB.UTF-8
24 call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__"))
25 catch /^Vim\%((\a\+)\)\=:E197:/
26 throw "Skipped: not possible to set locale to en (missing?)"
27 endtry
28
29 catch /^Vim\%((\a\+)\)\=:E342:/
30 throw "Skipped: out of memory executing bindtextdomain()"
Christ van Willegence0ef912024-06-20 23:41:59 +020031 endtry
32 set encoding&
33endfunc
34
35" vim: shiftwidth=2 sts=2 expandtab