mirror of
https://github.com/vim/vim.git
synced 2025-10-07 05:54:16 -04:00
patch 9.0.1091: assignment to non-existing member causes a crash
Problem: Assignment to non-existing member causes a crash. (Yegappan Lakshmanan) Solution: Give an error message and bail out when a member cannot be found.
This commit is contained in:
@@ -108,6 +108,17 @@ def Test_class_basic()
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E1022:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
class Something
|
||||
def new()
|
||||
this.state = 0
|
||||
enddef
|
||||
endclass
|
||||
var obj = Something.new()
|
||||
END
|
||||
v9.CheckScriptFailure(lines, 'E1089:')
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
class Something
|
||||
@@ -330,7 +341,9 @@ def Test_class_member_access()
|
||||
assert_equal(0, TextPos.counter)
|
||||
TextPos.AddToCounter(3)
|
||||
assert_equal(3, TextPos.counter)
|
||||
assert_fails('echo TextPos.noSuchMember', 'E1338:')
|
||||
|
||||
assert_fails('TextPos.noSuchMember = 2', 'E1337:')
|
||||
assert_fails('TextPos.counter += 5', 'E1335')
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
|
Reference in New Issue
Block a user