Christ van Willegen | ce0ef91 | 2024-06-20 23:41:59 +0200 | [diff] [blame] | 1 | source check.vim |
RestorerZ | 9650910 | 2024-07-11 21:14:15 +0200 | [diff] [blame] | 2 | " This fail on CI MacOS 14 because bindtextdomain() is not available there |
| 3 | " (missing library?) |
Christian Brabandt | 6bc11c0 | 2024-06-21 07:31:04 +0200 | [diff] [blame] | 4 | CheckNotMac |
Christ van Willegen | 8252ef1 | 2024-07-11 21:36:21 +0200 | [diff] [blame] | 5 | CheckFeature gettext |
Christ van Willegen | ce0ef91 | 2024-06-20 23:41:59 +0200 | [diff] [blame] | 6 | |
| 7 | " Test for gettext() |
| 8 | func Test_gettext() |
| 9 | set encoding=utf-8 |
Christ van Willegen | 8252ef1 | 2024-07-11 21:36:21 +0200 | [diff] [blame] | 10 | call assert_equal('ERROR: ', gettext("ERROR: ", "__PACKAGE__")) |
| 11 | |
Christ van Willegen | ce0ef91 | 2024-06-20 23:41:59 +0200 | [diff] [blame] | 12 | try |
Christ van Willegen | 8252ef1 | 2024-07-11 21:36:21 +0200 | [diff] [blame] | 13 | call assert_true(bindtextdomain("__PACKAGE__", getcwd())) |
| 14 | |
| 15 | try |
| 16 | language messages ru_RU |
| 17 | call assert_equal('ОШИБКА: ', gettext("ERROR: ", "__PACKAGE__")) |
| 18 | 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 Willegen | ce0ef91 | 2024-06-20 23:41:59 +0200 | [diff] [blame] | 31 | endtry |
| 32 | set encoding& |
| 33 | endfunc |
| 34 | |
| 35 | " vim: shiftwidth=2 sts=2 expandtab |