Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | Tests for reading and writing files with conversion for Win32. |
| 2 | |
| 3 | STARTTEST |
| 4 | :so mbyte.vim |
| 5 | :" make this a dummy test for non-Win32 systems |
| 6 | :if !has("win32") | e! test.ok | wq! test.out | endif |
| 7 | :" |
| 8 | :" write tests: |
| 9 | :" combine three values for 'encoding' with three values for 'fileencoding' |
| 10 | :" also write files for read tests |
| 11 | /^1 |
| 12 | :set encoding=utf-8 |
| 13 | :.w! ++enc=utf-8 test.out |
| 14 | :.w ++enc=cp1251 >>test.out |
| 15 | :.w ++enc=cp866 >>test.out |
| 16 | :.w! ++enc=utf-8 Xutf8 |
| 17 | /^2 |
| 18 | :set encoding=cp1251 |
| 19 | :.w ++enc=utf-8 >>test.out |
| 20 | :.w ++enc=cp1251 >>test.out |
| 21 | :.w ++enc=cp866 >>test.out |
| 22 | :.w! ++enc=cp1251 Xcp1251 |
| 23 | /^3 |
| 24 | :set encoding=cp866 |
| 25 | :.w ++enc=utf-8 >>test.out |
| 26 | :.w ++enc=cp1251 >>test.out |
| 27 | :.w ++enc=cp866 >>test.out |
| 28 | :.w! ++enc=cp866 Xcp866 |
| 29 | :" |
| 30 | :" read three 'fileencoding's with utf-8 'encoding' |
| 31 | :set encoding=utf-8 fencs=utf-8,cp1251 |
| 32 | :e Xutf8 |
| 33 | :.w ++enc=utf-8 >>test.out |
| 34 | :e Xcp1251 |
| 35 | :.w ++enc=utf-8 >>test.out |
| 36 | :set fencs=utf-8,cp866 |
| 37 | :e Xcp866 |
| 38 | :.w ++enc=utf-8 >>test.out |
| 39 | :" |
| 40 | :" read three 'fileencoding's with cp1251 'encoding' |
| 41 | :set encoding=utf-8 fencs=utf-8,cp1251 |
| 42 | :e Xutf8 |
| 43 | :.w ++enc=cp1251 >>test.out |
| 44 | :e Xcp1251 |
| 45 | :.w ++enc=cp1251 >>test.out |
| 46 | :set fencs=utf-8,cp866 |
| 47 | :e Xcp866 |
| 48 | :.w ++enc=cp1251 >>test.out |
| 49 | :" |
| 50 | :" read three 'fileencoding's with cp866 'encoding' |
| 51 | :set encoding=cp866 fencs=utf-8,cp1251 |
| 52 | :e Xutf8 |
| 53 | :.w ++enc=cp866 >>test.out |
| 54 | :e Xcp1251 |
| 55 | :.w ++enc=cp866 >>test.out |
| 56 | :set fencs=utf-8,cp866 |
| 57 | :e Xcp866 |
| 58 | :.w ++enc=cp866 >>test.out |
| 59 | :" |
| 60 | :qa! |
| 61 | ENDTEST |
| 62 | |
| 63 | 1 utf-8 text: ÐÐ»Ñ Vim version 6.2. ÐоÑледнее изменение: 1970 Jan 01 |
| 64 | 2 cp1251 text: Äëÿ Vim version 6.2. Ïîñëåäíåå èçìåíåíèå: 1970 Jan 01 |
| 65 | 3 cp866 text: «ï Vim version 6.2. ®á«¥¤¥¥ ¨§¬¥¥¨¥: 1970 Jan 01 |