summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_vim9_class.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-01-05 19:59:18 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-05 19:59:18 +0000
commit554d0313022c3977c71f7dcbc5c841ef43d988a6 (patch)
treee21ee06542388f5757b04f8cd987cfada2932db1 /src/testdir/test_vim9_class.vim
parentcf760d50dceb46bd583321c210b88b92360eb959 (diff)
patch 9.0.1150: :interface is not implemented yetv9.0.1150
Problem: :interface is not implemented yet. Solution: Implement the basics of :interface.
Diffstat (limited to 'src/testdir/test_vim9_class.vim')
-rw-r--r--src/testdir/test_vim9_class.vim60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index b98b96f58e..8c37a60906 100644
--- 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