Mercurial > vim
comparison src/testdir/test_functions.vim @ 17916:2e53305f2239 v8.1.1954
patch 8.1.1954: more functions can be used as a method
Commit: https://github.com/vim/vim/commit/02b31110d31e995326080807716e79e38fe501df
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 31 22:16:38 2019 +0200
patch 8.1.1954: more functions can be used as a method
Problem: More functions can be used as a method.
Solution: Allow more functions to be used as a method.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 31 Aug 2019 22:30:03 +0200 |
parents | af3d441845cd |
children | 0cdb6ac20748 |
comparison
equal
deleted
inserted
replaced
17915:50ad0353c88a | 17916:2e53305f2239 |
---|---|
881 | 881 |
882 set fileformat=mac | 882 set fileformat=mac |
883 call assert_equal([-1, -1, 1, 1, 2, 2, 2, 3, 3, -1], | 883 call assert_equal([-1, -1, 1, 1, 2, 2, 2, 3, 3, -1], |
884 \ map(range(-1, 8), 'v:val->byte2line()')) | 884 \ map(range(-1, 8), 'v:val->byte2line()')) |
885 call assert_equal([-1, -1, 1, 3, 6, 8, -1], | 885 call assert_equal([-1, -1, 1, 3, 6, 8, -1], |
886 \ map(range(-1, 5), 'line2byte(v:val)')) | 886 \ map(range(-1, 5), 'v:val->line2byte()')) |
887 | 887 |
888 set fileformat=dos | 888 set fileformat=dos |
889 call assert_equal([-1, -1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, -1], | 889 call assert_equal([-1, -1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, -1], |
890 \ map(range(-1, 11), 'byte2line(v:val)')) | 890 \ map(range(-1, 11), 'byte2line(v:val)')) |
891 call assert_equal([-1, -1, 1, 4, 8, 11, -1], | 891 call assert_equal([-1, -1, 1, 4, 8, 11, -1], |
1349 return | 1349 return |
1350 endif | 1350 endif |
1351 endif | 1351 endif |
1352 | 1352 |
1353 if has('win32') | 1353 if has('win32') |
1354 call assert_equal($USERPROFILE, libcall(libc, 'getenv', 'USERPROFILE')) | 1354 call assert_equal($USERPROFILE, 'USERPROFILE'->libcall(libc, 'getenv')) |
1355 else | 1355 else |
1356 call assert_equal($HOME, libcall(libc, 'getenv', 'HOME')) | 1356 call assert_equal($HOME, 'HOME'->libcall(libc, 'getenv')) |
1357 endif | 1357 endif |
1358 | 1358 |
1359 " If function returns NULL, libcall() should return an empty string. | 1359 " If function returns NULL, libcall() should return an empty string. |
1360 call assert_equal('', libcall(libc, 'getenv', 'X_ENV_DOES_NOT_EXIT')) | 1360 call assert_equal('', libcall(libc, 'getenv', 'X_ENV_DOES_NOT_EXIT')) |
1361 | 1361 |
1362 " Test libcallnr() with string and integer argument. | 1362 " Test libcallnr() with string and integer argument. |
1363 call assert_equal(4, libcallnr(libc, 'strlen', 'abcd')) | 1363 call assert_equal(4, 'abcd'->libcallnr(libc, 'strlen')) |
1364 call assert_equal(char2nr('A'), libcallnr(libc, 'toupper', char2nr('a'))) | 1364 call assert_equal(char2nr('A'), char2nr('a')->libcallnr(libc, 'toupper')) |
1365 | 1365 |
1366 call assert_fails("call libcall(libc, 'Xdoesnotexist_', '')", 'E364:') | 1366 call assert_fails("call libcall(libc, 'Xdoesnotexist_', '')", 'E364:') |
1367 call assert_fails("call libcallnr(libc, 'Xdoesnotexist_', '')", 'E364:') | 1367 call assert_fails("call libcallnr(libc, 'Xdoesnotexist_', '')", 'E364:') |
1368 | 1368 |
1369 call assert_fails("call libcall('Xdoesnotexist_', 'getenv', 'HOME')", 'E364:') | 1369 call assert_fails("call libcall('Xdoesnotexist_', 'getenv', 'HOME')", 'E364:') |