summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_gettext_cp1251.vim
blob: 69d2bbf4cd1c1d5021147e9a684bb788709c5bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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=cp1251
  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