mirror of
https://github.com/vim/vim.git
synced 2025-10-08 06:04:08 -04:00
patch 9.0.1060: private and public object members are not implemented yet
problem: Private and public object members are not implemented yet. Solution: Implement private and public object members.
This commit is contained in:
@@ -283,6 +283,33 @@ def Test_class_object_member_inits()
|
||||
v9.CheckScriptFailure(lines, 'E1330:')
|
||||
enddef
|
||||
|
||||
def Test_class_object_member_access()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
class Triple
|
||||
this._one = 1
|
||||
this.two = 2
|
||||
public this.three = 3
|
||||
|
||||
def GetOne(): number
|
||||
return this._one
|
||||
enddef
|
||||
endclass
|
||||
|
||||
var trip = Triple.new()
|
||||
assert_equal(1, trip.GetOne())
|
||||
assert_equal(2, trip.two)
|
||||
assert_equal(3, trip.three)
|
||||
assert_fails('echo trip._one', 'E1333')
|
||||
|
||||
assert_fails('trip._one = 11', 'E1333')
|
||||
assert_fails('trip.two = 22', 'E1335')
|
||||
trip.three = 33
|
||||
assert_equal(33, trip.three)
|
||||
END
|
||||
v9.CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_class_object_to_string()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
|
Reference in New Issue
Block a user