summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_vim9_class.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:06:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:06:15 +0000
commit45e7de1c4f501ef5d3b6f08126a2ad82ccb07533 (patch)
treeb5039a1ec7ad36b69e101b52645040b88a2e929b /src/testdir/test_vim9_class.vim
parentAdding upstream version 2:9.1.0374. (diff)
downloadvim-45e7de1c4f501ef5d3b6f08126a2ad82ccb07533.tar.xz
vim-45e7de1c4f501ef5d3b6f08126a2ad82ccb07533.zip
Adding upstream version 2:9.1.0377.upstream/2%9.1.0377
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_vim9_class.vim')
-rw-r--r--src/testdir/test_vim9_class.vim52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 5957f57..bd06c6e 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -67,6 +67,42 @@ def Test_class_basic()
END
v9.CheckSourceFailure(lines, "E488: Trailing characters: | echo 'done'", 3)
+ # Additional command after "class name"
+ lines =<< trim END
+ vim9script
+ class Something | var x = 10
+ endclass
+ END
+ v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", 2)
+
+ # Additional command after "object variable"
+ lines =<< trim END
+ vim9script
+ class Something
+ var l: list<number> = [] | var y = 10
+ endclass
+ END
+ v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
+
+ # Additional command after "class variable"
+ lines =<< trim END
+ vim9script
+ class Something
+ static var d = {a: 10} | var y = 10
+ endclass
+ END
+ v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
+
+ # Additional command after "object method"
+ lines =<< trim END
+ vim9script
+ class Something
+ def Foo() | var y = 10
+ enddef
+ endclass
+ END
+ v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", 3)
+
# Try to define a class with the same name as an existing variable
lines =<< trim END
vim9script
@@ -2237,6 +2273,14 @@ def Test_interface_basics()
END
v9.CheckSourceFailure(lines, 'E1345: Not a valid command in an interface: return 5', 6)
+ # Additional commands after "interface name"
+ lines =<< trim END
+ vim9script
+ interface Something | var x = 10 | var y = 20
+ endinterface
+ END
+ v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", 2)
+
lines =<< trim END
vim9script
export interface EnterExit
@@ -3233,6 +3277,14 @@ def Test_abstract_class()
END
v9.CheckSourceFailure(lines, 'E1316: Class can only be defined in Vim9 script', 1)
+ # Additional commands after "abstract class"
+ lines =<< trim END
+ vim9script
+ abstract class Something | var x = []
+ endclass
+ END
+ v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = []", 2)
+
# Abstract class cannot have a "new" function
lines =<< trim END
vim9script