Mercurial > vim
diff src/testdir/test_vim9_class.vim @ 31635:5c1b7a87466e v9.0.1150
patch 9.0.1150: :interface is not implemented yet
Commit: https://github.com/vim/vim/commit/554d0313022c3977c71f7dcbc5c841ef43d988a6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 5 19:59:18 2023 +0000
patch 9.0.1150: :interface is not implemented yet
Problem: :interface is not implemented yet.
Solution: Implement the basics of :interface.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 05 Jan 2023 21:00:06 +0100 |
parents | d19377e0a0b4 |
children | 62237ea155d9 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_class.vim +++ b/src/testdir/test_vim9_class.vim @@ -552,5 +552,65 @@ def Test_class_object_to_string() v9.CheckScriptSuccess(lines) enddef +def Test_interface_basics() + var lines =<< trim END + vim9script + interface Something + this.value: string + static count: number + def GetCount(): number + endinterface + END + v9.CheckScriptSuccess(lines) + + lines =<< trim END + interface SomethingWrong + static count = 7 + endinterface + END + v9.CheckScriptFailure(lines, 'E1342:') + + lines =<< trim END + vim9script + + interface Some + static count: number + def Method(count: number) + endinterface + END + # TODO: this should give an error for "count" shadowing + v9.CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + interface somethingWrong + static count = 7 + endinterface + END + v9.CheckScriptFailure(lines, 'E1343: Interface name must start with an uppercase letter: somethingWrong') + + lines =<< trim END + vim9script + interface SomethingWrong + this.value: string + static count = 7 + def GetCount(): number + endinterface + END + v9.CheckScriptFailure(lines, 'E1344:') + + lines =<< trim END + vim9script + interface SomethingWrong + this.value: string + static count: number + def GetCount(): number + return 5 + enddef + endinterface + END + v9.CheckScriptFailure(lines, 'E1345: Not a valid command in an interface: return 5') +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker