patch 9.1.0985: Vim9: some ex commands can be shortened
Problem: Vim9: some ex commands can be shortened
Solution: disallow shortening of :abstract, :interface and :type
(h-east)
closes: #16356
Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 309898b..4a7962a 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -2386,6 +2386,22 @@
END
v9.CheckSourceFailure(lines, 'E1345: Not a valid command in an interface: return 5', 6)
+ # Test for "interface" cannot be abbreviated
+ lines =<< trim END
+ vim9script
+ inte Something
+ endinterface
+ END
+ v9.CheckSourceFailure(lines, 'E1065: Command cannot be shortened: inte Something', 2)
+
+ # Test for "endinterface" cannot be abbreviated
+ lines =<< trim END
+ vim9script
+ interface Something
+ endin
+ END
+ v9.CheckSourceFailure(lines, 'E1065: Command cannot be shortened: endin', 3)
+
# Additional commands after "interface name"
lines =<< trim END
vim9script
@@ -3525,6 +3541,14 @@
END
v9.CheckSourceFailure(lines, 'E1316: Class can only be defined in Vim9 script', 1)
+ # Test for "abstract" cannot be abbreviated
+ lines =<< trim END
+ vim9script
+ abs class A
+ endclass
+ END
+ v9.CheckSourceFailure(lines, 'E1065: Command cannot be shortened: abs class A', 2)
+
# Additional commands after "abstract class"
lines =<< trim END
vim9script