aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir/test_indent.vim
diff options
context:
space:
mode:
Diffstat (limited to 'test/old/testdir/test_indent.vim')
-rw-r--r--test/old/testdir/test_indent.vim76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/old/testdir/test_indent.vim b/test/old/testdir/test_indent.vim
index dcacc11663..630beed810 100644
--- a/test/old/testdir/test_indent.vim
+++ b/test/old/testdir/test_indent.vim
@@ -1,5 +1,8 @@
" Test for various indent options
+source shared.vim
+source check.vim
+
func Test_preserveindent()
new
" Test for autoindent copying indent from the previous line
@@ -276,4 +279,77 @@ func Test_formatting_keeps_first_line_indent()
bwipe!
endfunc
+" Test for indenting with large amount, causes overflow
+func Test_indent_overflow_count()
+ throw 'skipped: TODO: '
+ new
+ setl sw=8
+ call setline(1, "abc")
+ norm! V2147483647>
+ " indents by INT_MAX
+ call assert_equal(2147483647, indent(1))
+ close!
+endfunc
+
+func Test_indent_overflow_count2()
+ throw 'skipped: Nvim does not support 64-bit number options'
+ new
+ " this only works, when long is 64bits
+ try
+ setl sw=0x180000000
+ catch /^Vim\%((\a\+)\)\=:E487:/
+ throw 'Skipped: value negative on this platform'
+ endtry
+ call setline(1, "\tabc")
+ norm! <<
+ call assert_equal(0, indent(1))
+ close!
+endfunc
+
+" Test that mouse shape is restored to Normal mode after using "gq" when
+" 'indentexpr' executes :normal.
+func Test_mouse_shape_indent_norm_with_gq()
+ CheckFeature mouseshape
+ CheckCanRunGui
+
+ let lines =<< trim END
+ func Indent()
+ exe "normal! \<Ignore>"
+ return 0
+ endfunc
+
+ setlocal indentexpr=Indent()
+ END
+ call writefile(lines, 'Xindentexpr.vim', 'D')
+
+ let lines =<< trim END
+ vim9script
+ var mouse_shapes = []
+
+ setline(1, [repeat('a', 80), repeat('b', 80)])
+
+ feedkeys('ggVG')
+ timer_start(50, (_) => {
+ mouse_shapes += [getmouseshape()]
+ timer_start(50, (_) => {
+ feedkeys('gq')
+ timer_start(50, (_) => {
+ mouse_shapes += [getmouseshape()]
+ timer_start(50, (_) => {
+ writefile(mouse_shapes, 'Xmouseshapes')
+ quit!
+ })
+ })
+ })
+ })
+ END
+ call writefile(lines, 'Xmouseshape.vim', 'D')
+
+ call RunVim([], [], "-g -S Xindentexpr.vim -S Xmouseshape.vim")
+ call WaitForAssert({-> assert_equal(['rightup-arrow', 'arrow'],
+ \ readfile('Xmouseshapes'))}, 300)
+
+ call delete('Xmouseshapes')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab