feat(eval/method): partially port v8.1.1925

Adds method call support for all functions in the patch, but it cannot
be fully ported due to missing tests for:

- getcwd(): requires chdir() and Test_chdir_func() from v8.1.1291.

Note that the method call tests for getreg() and getregtype() were
removed in v8.2.1547, which has already been ported, but doesn't seem to
have been replaced with a new test...

This patch also makes getchangelist()'s argument optional (defaults to
the current buffer).

eval.txt includes a typo for gettabwinvar(), which is fixed in
v8.1.1952.
This commit is contained in:
Sean Dewar 2021-08-27 21:09:37 +01:00
parent 6110480c29
commit 3137c7d635
No known key found for this signature in database
GPG Key ID: 08CC2C83AD41B581
13 changed files with 107 additions and 44 deletions

View File

@ -4701,6 +4701,9 @@ getbufline({buf}, {lnum} [, {end}])
Example: > Example: >
:let lines = getbufline(bufnr("myfile"), 1, "$") :let lines = getbufline(bufnr("myfile"), 1, "$")
< Can also be used as a |method|: >
GetBufnr()->getbufline(lnum)
getbufvar({buf}, {varname} [, {def}]) *getbufvar()* getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
The result is the value of option or local buffer variable The result is the value of option or local buffer variable
{varname} in buffer {buf}. Note that the name without "b:" {varname} in buffer {buf}. Note that the name without "b:"
@ -4721,8 +4724,11 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
Examples: > Examples: >
:let bufmodified = getbufvar(1, "&mod") :let bufmodified = getbufvar(1, "&mod")
:echo "todo myvar = " . getbufvar("todo", "myvar") :echo "todo myvar = " . getbufvar("todo", "myvar")
< Can also be used as a |method|: >
GetBufnr()->getbufvar(varname)
< <
getchangelist({buf}) *getchangelist()* getchangelist([{buf}]) *getchangelist()*
Returns the |changelist| for the buffer {buf}. For the use Returns the |changelist| for the buffer {buf}. For the use
of {buf}, see |bufname()| above. If buffer {buf} doesn't of {buf}, see |bufname()| above. If buffer {buf} doesn't
exist, an empty list is returned. exist, an empty list is returned.
@ -4738,6 +4744,9 @@ getchangelist({buf}) *getchangelist()*
position refers to the position in the list. For other position refers to the position in the list. For other
buffers, it is set to the length of the list. buffers, it is set to the length of the list.
Can also be used as a |method|: >
GetBufnr()->getchangelist()
getchar([expr]) *getchar()* getchar([expr]) *getchar()*
Get a single character from the user or input stream. Get a single character from the user or input stream.
If [expr] is omitted, wait until a character is available. If [expr] is omitted, wait until a character is available.
@ -4948,6 +4957,9 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
If there are no matches, an empty list is returned. An If there are no matches, an empty list is returned. An
invalid value for {type} produces an error. invalid value for {type} produces an error.
Can also be used as a |method|: >
GetPattern()->getcompletion('color')
<
*getcurpos()* *getcurpos()*
getcurpos() Get the position of the cursor. This is like getpos('.'), but getcurpos() Get the position of the cursor. This is like getpos('.'), but
includes an extra "curswant" in the list: includes an extra "curswant" in the list:
@ -4976,6 +4988,9 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()*
< If {winnr} is -1 it is ignored, only the tab is resolved. < If {winnr} is -1 it is ignored, only the tab is resolved.
{winnr} can be the window number or the |window-ID|. {winnr} can be the window number or the |window-ID|.
Can also be used as a |method|: >
GetWinnr()->getcwd()
getenv({name}) *getenv()* getenv({name}) *getenv()*
Return the value of environment variable {name}. The {name} Return the value of environment variable {name}. The {name}
argument is a string, without a leading '$'. Example: > argument is a string, without a leading '$'. Example: >
@ -4985,6 +5000,9 @@ getenv({name}) *getenv()*
is different from a variable set to an empty string. is different from a variable set to an empty string.
See also |expr-env|. See also |expr-env|.
Can also be used as a |method|: >
GetVarname()->getenv()
getfontname([{name}]) *getfontname()* getfontname([{name}]) *getfontname()*
Without an argument returns the name of the normal font being Without an argument returns the name of the normal font being
used. Like what is used for the Normal highlight group used. Like what is used for the Normal highlight group
@ -5012,6 +5030,9 @@ getfperm({fname}) *getfperm()*
< This will hopefully (from a security point of view) display < This will hopefully (from a security point of view) display
the string "rw-r--r--" or even "rw-------". the string "rw-r--r--" or even "rw-------".
Can also be used as a |method|: >
GetFilename()->getfperm()
<
For setting permissions use |setfperm()|. For setting permissions use |setfperm()|.
getfsize({fname}) *getfsize()* getfsize({fname}) *getfsize()*
@ -5022,6 +5043,9 @@ getfsize({fname}) *getfsize()*
If the size of {fname} is too big to fit in a Number then -2 If the size of {fname} is too big to fit in a Number then -2
is returned. is returned.
Can also be used as a |method|: >
GetFilename()->getfsize()
getftime({fname}) *getftime()* getftime({fname}) *getftime()*
The result is a Number, which is the last modification time of The result is a Number, which is the last modification time of
the given file {fname}. The value is measured as seconds the given file {fname}. The value is measured as seconds
@ -5029,6 +5053,9 @@ getftime({fname}) *getftime()*
|localtime()| and |strftime()|. |localtime()| and |strftime()|.
If the file {fname} can't be found -1 is returned. If the file {fname} can't be found -1 is returned.
Can also be used as a |method|: >
GetFilename()->getftime()
getftype({fname}) *getftype()* getftype({fname}) *getftype()*
The result is a String, which is a description of the kind of The result is a String, which is a description of the kind of
file of the given file {fname}. file of the given file {fname}.
@ -5049,6 +5076,9 @@ getftype({fname}) *getftype()*
systems that support it. On some systems only "dir" and systems that support it. On some systems only "dir" and
"file" are returned. "file" are returned.
Can also be used as a |method|: >
GetFilename()->getftype()
getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
Returns the |jumplist| for the specified window. Returns the |jumplist| for the specified window.
@ -5068,7 +5098,10 @@ getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
filename filename if available filename filename if available
lnum line number lnum line number
*getline()* Can also be used as a |method|: >
GetWinnr()->getjumplist()
< *getline()*
getline({lnum} [, {end}]) getline({lnum} [, {end}])
Without {end} the result is a String, which is line {lnum} Without {end} the result is a String, which is line {lnum}
from the current buffer. Example: > from the current buffer. Example: >
@ -5091,6 +5124,9 @@ getline({lnum} [, {end}])
:let end = search("^$") - 1 :let end = search("^$") - 1
:let lines = getline(start, end) :let lines = getline(start, end)
< Can also be used as a |method|: >
ComputeLnum()->getline()
< To get lines from another buffer see |getbufline()| < To get lines from another buffer see |getbufline()|
getloclist({nr},[, {what}]) *getloclist()* getloclist({nr},[, {what}]) *getloclist()*
@ -5221,6 +5257,8 @@ getpos({expr}) Get the position for String {expr}. For possible values of
call setpos("'a", save_a_mark) call setpos("'a", save_a_mark)
< Also see |getcurpos()| and |setpos()|. < Also see |getcurpos()| and |setpos()|.
Can also be used as a |method|: >
GetMark()->getpos()
getqflist([{what}]) *getqflist()* getqflist([{what}]) *getqflist()*
Returns a |List| with all the current quickfix errors. Each Returns a |List| with all the current quickfix errors. Each
@ -5339,6 +5377,9 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()*
If {regname} is not specified, |v:register| is used. If {regname} is not specified, |v:register| is used.
Can also be used as a |method|: >
GetRegname()->getreg()
getreginfo([{regname}]) *getreginfo()* getreginfo([{regname}]) *getreginfo()*
Returns detailed information about register {regname} as a Returns detailed information about register {regname} as a
Dictionary with the following entries: Dictionary with the following entries:
@ -5377,6 +5418,9 @@ getregtype([{regname}]) *getregtype()*
The {regname} argument is a string. If {regname} is not The {regname} argument is a string. If {regname} is not
specified, |v:register| is used. specified, |v:register| is used.
Can also be used as a |method|: >
GetRegname()->getregtype()
gettabinfo([{tabnr}]) *gettabinfo()* gettabinfo([{tabnr}]) *gettabinfo()*
If {tabnr} is not specified, then information about all the If {tabnr} is not specified, then information about all the
tab pages is returned as a |List|. Each List item is a tab pages is returned as a |List|. Each List item is a
@ -5390,6 +5434,9 @@ gettabinfo([{tabnr}]) *gettabinfo()*
tabpage-local variables tabpage-local variables
windows List of |window-ID|s in the tab page. windows List of |window-ID|s in the tab page.
Can also be used as a |method|: >
GetTabnr()->gettabinfo()
gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
Get the value of a tab-local variable {varname} in tab page Get the value of a tab-local variable {varname} in tab page
{tabnr}. |t:var| {tabnr}. |t:var|
@ -5400,6 +5447,9 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
When the tab or variable doesn't exist {def} or an empty When the tab or variable doesn't exist {def} or an empty
string is returned, there is no error message. string is returned, there is no error message.
Can also be used as a |method|: >
GetTabnr()->gettabvar(varname)
gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
Get the value of window-local variable {varname} in window Get the value of window-local variable {varname} in window
{winnr} in tab page {tabnr}. {winnr} in tab page {tabnr}.
@ -5426,6 +5476,9 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
To obtain all window-local variables use: > To obtain all window-local variables use: >
gettabwinvar({tabnr}, {winnr}, '&') gettabwinvar({tabnr}, {winnr}, '&')
< Can also be used as a |method|: >
GetTabnr()->gettabvar(winnr, varname)
gettagstack([{winnr}]) *gettagstack()* gettagstack([{winnr}]) *gettagstack()*
The result is a Dict, which is the tag stack of window {winnr}. The result is a Dict, which is the tag stack of window {winnr}.
{winnr} can be the window number or the |window-ID|. {winnr} can be the window number or the |window-ID|.
@ -8339,6 +8392,9 @@ setfperm({fname}, {mode}) *setfperm()* *chmod*
Returns non-zero for success, zero for failure. Returns non-zero for success, zero for failure.
Can also be used as a |method|: >
GetFilename()->setfperm(mode)
<
To read permissions see |getfperm()|. To read permissions see |getfperm()|.
setline({lnum}, {text}) *setline()* setline({lnum}, {text}) *setline()*

View File

@ -137,9 +137,9 @@ return {
garbagecollect={args={0, 1}}, garbagecollect={args={0, 1}},
get={args={2, 3}, base=1}, get={args={2, 3}, base=1},
getbufinfo={args={0, 1}}, getbufinfo={args={0, 1}},
getbufline={args={2, 3}}, getbufline={args={2, 3}, base=1},
getbufvar={args={2, 3}}, getbufvar={args={2, 3}, base=1},
getchangelist={args={1, 1}}, getchangelist={args={0, 1}, base=1},
getchar={args={0, 1}}, getchar={args={0, 1}},
getcharmod={}, getcharmod={},
getcharsearch={}, getcharsearch={},
@ -148,30 +148,30 @@ return {
getcmdpos={}, getcmdpos={},
getcmdtype={}, getcmdtype={},
getcmdwintype={}, getcmdwintype={},
getcompletion={args={2, 3}}, getcompletion={args={2, 3}, base=1},
getcurpos={}, getcurpos={},
getcwd={args={0,2}}, getcwd={args={0, 2}, base=1},
getenv={args={1}}, getenv={args={1}, base=1},
getfontname={args={0, 1}}, getfontname={args={0, 1}},
getfperm={args=1}, getfperm={args=1, base=1},
getfsize={args=1}, getfsize={args=1, base=1},
getftime={args=1}, getftime={args=1, base=1},
getftype={args=1}, getftype={args=1, base=1},
getjumplist={args={0, 2}}, getjumplist={args={0, 2}, base=1},
getline={args={1, 2}}, getline={args={1, 2}, base=1},
getloclist={args={1, 2}}, getloclist={args={1, 2}},
getmarklist={args={0, 1}}, getmarklist={args={0, 1}},
getmatches={args={0, 1}}, getmatches={args={0, 1}},
getmousepos={}, getmousepos={},
getpid={}, getpid={},
getpos={args=1}, getpos={args=1, base=1},
getqflist={args={0, 1}}, getqflist={args={0, 1}},
getreg={args={0, 3}}, getreg={args={0, 3}, base=1},
getreginfo={args={0, 1}, base=1}, getreginfo={args={0, 1}, base=1},
getregtype={args={0, 1}}, getregtype={args={0, 1}, base=1},
gettabinfo={args={0, 1}}, gettabinfo={args={0, 1}, base=1},
gettabvar={args={2, 3}}, gettabvar={args={2, 3}, base=1},
gettabwinvar={args={3, 4}}, gettabwinvar={args={3, 4}, base=1},
gettagstack={args={0, 1}}, gettagstack={args={0, 1}},
getwininfo={args={0, 1}}, getwininfo={args={0, 1}},
getwinpos={args={0, 1}}, getwinpos={args={0, 1}},
@ -311,7 +311,7 @@ return {
setcharsearch={args=1}, setcharsearch={args=1},
setcmdpos={args=1}, setcmdpos={args=1},
setenv={args=2}, setenv={args=2},
setfperm={args=2}, setfperm={args=2, base=1},
setline={args=2}, setline={args=2},
setloclist={args={2, 4}}, setloclist={args={2, 4}},
setmatches={args={1, 2}}, setmatches={args={1, 2}},

View File

@ -3088,10 +3088,16 @@ f_getbufvar_end:
static void f_getchangelist(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_getchangelist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{ {
tv_list_alloc_ret(rettv, 2); tv_list_alloc_ret(rettv, 2);
vim_ignored = tv_get_number(&argvars[0]); // issue errmsg if type error
emsg_off++; const buf_T *buf;
const buf_T *const buf = tv_get_buf(&argvars[0], false); if (argvars[0].v_type == VAR_UNKNOWN) {
emsg_off--; buf = curbuf;
} else {
vim_ignored = tv_get_number(&argvars[0]); // issue errmsg if type error
emsg_off++;
buf = tv_get_buf(&argvars[0], false);
emsg_off--;
}
if (buf == NULL) { if (buf == NULL) {
return; return;
} }

View File

@ -21,7 +21,7 @@ func Test_setbufline_getbufline()
call assert_equal(1, setbufline(b, 5, ['x'])) call assert_equal(1, setbufline(b, 5, ['x']))
call assert_equal(1, setbufline(1234, 1, ['x'])) call assert_equal(1, setbufline(1234, 1, ['x']))
call assert_equal(0, setbufline(b, 4, ['d', 'e'])) call assert_equal(0, setbufline(b, 4, ['d', 'e']))
call assert_equal(['c'], getbufline(b, 3)) call assert_equal(['c'], b->getbufline(3))
call assert_equal(['d'], getbufline(b, 4)) call assert_equal(['d'], getbufline(b, 4))
call assert_equal(['e'], getbufline(b, 5)) call assert_equal(['e'], getbufline(b, 5))
call assert_equal([], getbufline(b, 6)) call assert_equal([], getbufline(b, 6))

View File

@ -88,7 +88,7 @@ function Test_getbufwintabinfo()
call assert_equal(2, tablist[1].tabnr) call assert_equal(2, tablist[1].tabnr)
call assert_equal('build', tablist[0].variables.space) call assert_equal('build', tablist[0].variables.space)
call assert_equal(w2_id, tablist[0].windows[0]) call assert_equal(w2_id, tablist[0].windows[0])
call assert_equal([], gettabinfo(3)) call assert_equal([], 3->gettabinfo())
tabonly | only tabonly | only
@ -106,7 +106,7 @@ function Test_getbufwintabinfo()
endfunction endfunction
function Test_get_buf_options() function Test_get_buf_options()
let opts = getbufvar(bufnr('%'), '&') let opts = bufnr()->getbufvar('&')
call assert_equal(v:t_dict, type(opts)) call assert_equal(v:t_dict, type(opts))
call assert_equal(8, opts.tabstop) call assert_equal(8, opts.tabstop)
endfunc endfunc

View File

@ -8,8 +8,8 @@ func Test_getchangelist()
bwipe! bwipe!
enew enew
call assert_equal([], getchangelist(10)) call assert_equal([], 10->getchangelist())
call assert_equal([[], 0], getchangelist('%')) call assert_equal([[], 0], getchangelist())
call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt') call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt')
call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt') call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt')

View File

@ -260,7 +260,7 @@ func Test_getcompletion()
endif endif
let groupcount = len(getcompletion('', 'event')) let groupcount = len(getcompletion('', 'event'))
call assert_true(groupcount > 0) call assert_true(groupcount > 0)
let matchcount = len(getcompletion('File', 'event')) let matchcount = len('File'->getcompletion('event'))
call assert_true(matchcount > 0) call assert_true(matchcount > 0)
call assert_true(groupcount > matchcount) call assert_true(groupcount > matchcount)

View File

@ -201,11 +201,11 @@ func Test_edit_07()
endfu endfu
au InsertCharPre <buffer> :call DoIt() au InsertCharPre <buffer> :call DoIt()
call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx') call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx')
call assert_equal(["Jan\<c-l>",''], getline(1,'$')) call assert_equal(["Jan\<c-l>",''], 1->getline('$'))
%d %d
call setline(1, 'J') call setline(1, 'J')
call feedkeys("A\<f5>\<c-p>u\<down>\<c-l>\<cr>", 'tx') call feedkeys("A\<f5>\<c-p>u\<down>\<c-l>\<cr>", 'tx')
call assert_equal(["January"], getline(1,'$')) call assert_equal(["January"], 1->getline('$'))
delfu ListMonths delfu ListMonths
delfu DoIt delfu DoIt
@ -348,7 +348,7 @@ func Test_edit_12()
call cursor(2, 4) call cursor(2, 4)
call feedkeys("R^\<c-d>", 'tnix') call feedkeys("R^\<c-d>", 'tnix')
call assert_equal(["\tabc", "def"], getline(1, '$')) call assert_equal(["\tabc", "def"], getline(1, '$'))
call assert_equal([0, 2, 2, 0], getpos('.')) call assert_equal([0, 2, 2, 0], '.'->getpos())
%d %d
call setline(1, ["\tabc", "\t\tdef"]) call setline(1, ["\tabc", "\t\tdef"])
call cursor(2, 2) call cursor(2, 2)

View File

@ -15,7 +15,7 @@ endfunc
func Test_getenv() func Test_getenv()
unlet! $TESTENV unlet! $TESTENV
call assert_equal(v:null, getenv('TESTENV')) call assert_equal(v:null, 'TESTENV'->getenv())
let $TESTENV = 'foo' let $TESTENV = 'foo'
call assert_equal('foo', getenv('TESTENV')) call assert_equal('foo', getenv('TESTENV'))
endfunc endfunc

View File

@ -31,7 +31,7 @@ func Test_var()
let t:other = 777 let t:other = 777
let def_list = [4, 5, 6, 7] let def_list = [4, 5, 6, 7]
tabrewind tabrewind
call assert_equal([1, 2, 3], gettabvar(3, 'var_list')) call assert_equal([1, 2, 3], 3->gettabvar('var_list'))
call assert_equal([1, 2, 3], gettabvar(3, 'var_list', def_list)) call assert_equal([1, 2, 3], gettabvar(3, 'var_list', def_list))
call assert_equal({'var_list': [1, 2, 3], 'other': 777}, gettabvar(3, '')) call assert_equal({'var_list': [1, 2, 3], 'other': 777}, gettabvar(3, ''))
call assert_equal({'var_list': [1, 2, 3], 'other': 777}, call assert_equal({'var_list': [1, 2, 3], 'other': 777},
@ -61,7 +61,7 @@ func Test_var()
let def_dict = {'dict2': 'newval'} let def_dict = {'dict2': 'newval'}
wincmd b wincmd b
tabrewind tabrewind
call assert_equal({'dict': 'tabwin'}, gettabwinvar(2, 3, 'var_dict')) call assert_equal({'dict': 'tabwin'}, 2->gettabwinvar(3, 'var_dict'))
call assert_equal({'dict': 'tabwin'}, call assert_equal({'dict': 'tabwin'},
\ gettabwinvar(2, 3, 'var_dict', def_dict)) \ gettabwinvar(2, 3, 'var_dict', def_dict))
call assert_equal({'var_dict': {'dict': 'tabwin'}}, gettabwinvar(2, 3, '')) call assert_equal({'var_dict': {'dict': 'tabwin'}}, gettabwinvar(2, 3, ''))

View File

@ -39,7 +39,7 @@ func Test_getjumplist()
" Traverse the jump list and verify the results " Traverse the jump list and verify the results
5 5
exe "normal \<C-O>" exe "normal \<C-O>"
call assert_equal(2, getjumplist(1)[1]) call assert_equal(2, 1->getjumplist()[1])
exe "normal 2\<C-O>" exe "normal 2\<C-O>"
call assert_equal(0, getjumplist(1, 1)[1]) call assert_equal(0, getjumplist(1, 1)[1])
exe "normal 3\<C-I>" exe "normal 3\<C-I>"

View File

@ -10,7 +10,7 @@ func CheckFileTime(doSleep)
let fl = ['Hello World!'] let fl = ['Hello World!']
for fname in fnames for fname in fnames
call writefile(fl, fname) call writefile(fl, fname)
call add(times, getftime(fname)) call add(times, fname->getftime())
if a:doSleep if a:doSleep
sleep 1 sleep 1
endif endif
@ -19,8 +19,8 @@ func CheckFileTime(doSleep)
let time_correct = (times[0] <= times[1] && times[1] <= times[2]) let time_correct = (times[0] <= times[1] && times[1] <= times[2])
if a:doSleep || time_correct if a:doSleep || time_correct
call assert_true(time_correct, printf('Expected %s <= %s <= %s', times[0], times[1], times[2])) call assert_true(time_correct, printf('Expected %s <= %s <= %s', times[0], times[1], times[2]))
call assert_equal(strlen(fl[0] . "\n"), getfsize(fnames[0])) call assert_equal(strlen(fl[0] . "\n"), fnames[0]->getfsize())
call assert_equal('file', getftype(fnames[0])) call assert_equal('file', fnames[0]->getftype())
call assert_equal('rw-', getfperm(fnames[0])[0:2]) call assert_equal('rw-', getfperm(fnames[0])[0:2])
let result = 1 let result = 1
endif endif

View File

@ -3,7 +3,7 @@ require('os')
local helpers = require('test.functional.helpers')(after_each) local helpers = require('test.functional.helpers')(after_each)
local clear, call, eq = helpers.clear, helpers.call, helpers.eq local clear, call, eq = helpers.clear, helpers.call, helpers.eq
local neq, exc_exec = helpers.neq, helpers.exc_exec local neq, exc_exec, eval = helpers.neq, helpers.exc_exec, helpers.eval
describe('Test getting and setting file permissions', function() describe('Test getting and setting file permissions', function()
local tempfile = helpers.tmpname() local tempfile = helpers.tmpname()
@ -14,11 +14,12 @@ describe('Test getting and setting file permissions', function()
end) end)
it('file permissions', function() it('file permissions', function()
-- eval() is used to test VimL method syntax for setfperm() and getfperm()
eq('', call('getfperm', tempfile)) eq('', call('getfperm', tempfile))
eq(0, call('setfperm', tempfile, 'r--------')) eq(0, eval("'" .. tempfile .. "'->setfperm('r--------')"))
call('writefile', {'one'}, tempfile) call('writefile', {'one'}, tempfile)
eq(9, call('len', call('getfperm', tempfile))) eq(9, eval("len('" .. tempfile .. "'->getfperm())"))
eq(1, call('setfperm', tempfile, 'rwx------')) eq(1, call('setfperm', tempfile, 'rwx------'))
if helpers.is_os('win') then if helpers.is_os('win') then