mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.2.2840: Vim9: member operation not fully tested
Problem: Vim9: member operation not fully tested. Solution: Add a few tests.
This commit is contained in:
@@ -3066,6 +3066,10 @@ def Test_expr7_string_subscript()
|
||||
assert_equal('ábçd', text[: 3])
|
||||
assert_equal('bçdëf', text[1 :])
|
||||
assert_equal('ábçdëf', text[:])
|
||||
|
||||
assert_equal('a', g:astring[0])
|
||||
assert_equal('sd', g:astring[1 : 2])
|
||||
assert_equal('asdf', g:astring[:])
|
||||
END
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
|
||||
@@ -3135,6 +3139,9 @@ def Test_expr7_list_subscript()
|
||||
assert_equal([0], list[0 : -5])
|
||||
assert_equal([], list[0 : -6])
|
||||
assert_equal([], list[0 : -99])
|
||||
|
||||
assert_equal(2, g:alist[0])
|
||||
assert_equal([2, 3, 4], g:alist[:])
|
||||
END
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
|
||||
@@ -3157,6 +3164,9 @@ def Test_expr7_dict_subscript()
|
||||
var res = l[0].lnum > l[1].lnum
|
||||
assert_true(res)
|
||||
|
||||
assert_equal(2, g:adict['aaa'])
|
||||
assert_equal(8, g:adict.bbb)
|
||||
|
||||
var dd = {}
|
||||
def Func1()
|
||||
eval dd.key1.key2
|
||||
@@ -3169,6 +3179,18 @@ def Test_expr7_dict_subscript()
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_expr7_blob_subscript()
|
||||
var lines =<< trim END
|
||||
var b = 0z112233
|
||||
assert_equal(0x11, b[0])
|
||||
assert_equal(0z112233, b[:])
|
||||
|
||||
assert_equal(0x01, g:ablob[0])
|
||||
assert_equal(0z01ab, g:ablob[:])
|
||||
END
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_expr7_subscript_linebreak()
|
||||
var lines =<< trim END
|
||||
var range = range(
|
||||
|
Reference in New Issue
Block a user