summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:06:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 19:06:16 +0000
commit1585b6dc94be23cda47cdeac939c2c74a8bd4c37 (patch)
tree745848c44400b14f40b4fb05aaf634578a525020 /src/testdir
parentReleasing progress-linux version 2:9.1.0374-1~progress7.99u1. (diff)
downloadvim-1585b6dc94be23cda47cdeac939c2c74a8bd4c37.tar.xz
vim-1585b6dc94be23cda47cdeac939c2c74a8bd4c37.zip
Merging upstream version 2:9.1.0377.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/testdir/test_autocmd.vim3
-rw-r--r--src/testdir/test_textformat.vim24
-rw-r--r--src/testdir/test_vim9_class.vim52
-rw-r--r--src/testdir/test_vim9_enum.vim11
-rw-r--r--src/testdir/test_vim9_typealias.vim8
5 files changed, 97 insertions, 1 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 6745ecb..24e1daf 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -4687,6 +4687,9 @@ func Test_BufEnter_botline()
edit Xxx2
au BufEnter Xxx1 call assert_true(line('w$') > 1)
edit Xxx1
+
+ bwipe! Xxx1
+ bwipe! Xxx2
au! BufEnter Xxx1
set hidden&vim
endfunc
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim
index a9cffd0..5d58486 100644
--- a/src/testdir/test_textformat.vim
+++ b/src/testdir/test_textformat.vim
@@ -1312,4 +1312,28 @@ func Test_textwdith_overflow()
bw!
endfunc
+func Test_breakindent_reformat()
+ " Make sure textformatting uses the full width
+ " of the textwidth and does not consider the indent
+ " from breakindent into account when calculating the
+ " line length. Should break at tw 78 and not at 70
+ CheckOption breakindent
+ new
+ 80vnew
+ 39vnew
+ setl ai breakindent tw=78
+ let lorem = [
+ \ ' Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam luctus',
+ \ ' lectus sodales, dictum augue vel, molestie augue. Duis sit amet',
+ \ ' rhoncus justo. Nullam posuere risus semper magna commodo scelerisque.',
+ \ ' Duis et venenatis sem. In rhoncus augue sed tempor mattis. Mauris id',
+ \ ' aliquet odio.']
+ call setline(1, lorem)
+ norm! gqap
+ call assert_equal(lorem, getline(1, '$'))
+ bw!
+ bw!
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
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
diff --git a/src/testdir/test_vim9_enum.vim b/src/testdir/test_vim9_enum.vim
index 274b556..bc54bee 100644
--- a/src/testdir/test_vim9_enum.vim
+++ b/src/testdir/test_vim9_enum.vim
@@ -97,7 +97,16 @@ def Test_enum_parse()
vim9script
enum Something | endenum
END
- v9.CheckSourceFailure(lines, 'E1420: Missing :endenum', 3)
+ v9.CheckSourceFailure(lines, 'E488: Trailing characters: | endenum', 2)
+
+ # another command follows the enum name
+ lines =<< trim END
+ vim9script
+ enum Something | var x = 10
+ Foo
+ endenum
+ END
+ v9.CheckSourceFailure(lines, 'E488: Trailing characters: | var x = 10', 2)
# Try to define an enum with the same name as an existing variable
lines =<< trim END
diff --git a/src/testdir/test_vim9_typealias.vim b/src/testdir/test_vim9_typealias.vim
index 998079c..cf540c2 100644
--- a/src/testdir/test_vim9_typealias.vim
+++ b/src/testdir/test_vim9_typealias.vim
@@ -172,6 +172,14 @@ def Test_typealias()
END
v9.CheckSourceSuccess(lines)
+ # another command follows a type alias
+ lines =<< trim END
+ vim9script
+ type MyType = number | var x = 20
+ assert_equal(20, x)
+ END
+ v9.CheckSourceSuccess(lines)
+
# Sourcing a script twice (which will free script local variables)
# Uses "lines" from the previous test
new