diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2024-05-22 08:41:07 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-22 08:41:07 +0800 |
| commit | 10601ac5fa3cf3d26f315873dab4384045999c7f (patch) | |
| tree | f82603fdf2a69f51fe66586f0dcd779ad4268cb1 /test | |
| parent | d6be78cc98c49076f8b6c5b641b7ed403f4377c5 (diff) | |
| download | rneovim-10601ac5fa3cf3d26f315873dab4384045999c7f.tar.gz rneovim-10601ac5fa3cf3d26f315873dab4384045999c7f.tar.bz2 rneovim-10601ac5fa3cf3d26f315873dab4384045999c7f.zip | |
vim-patch:62ccaa6: runtime(termdebug): check for gdb file/dir before using as buffer name (#28908)
Add test so that this doesn't regress.
fixes: vim/vim#12718
closes: vim/vim#14792
https://github.com/vim/vim/commit/62ccaa60d5f7f9a13c758bd5e55b7ca6855a6de9
Co-authored-by: Ubaldo Tiberi <ubaldo.tiberi@volvo.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/old/testdir/test_termdebug.vim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim index b0f174ac0a..fd0c850577 100644 --- a/test/old/testdir/test_termdebug.vim +++ b/test/old/testdir/test_termdebug.vim @@ -302,4 +302,43 @@ func Test_termdebug_mapping() %bw! endfunc +func Test_termdebug_bufnames() + " Test if user has filename/folders named gdb, Termdebug-gdb-console, + " etc. in the current directory + let g:termdebug_config = {} + let g:termdebug_config['use_prompt'] = 1 + let filename = 'gdb' + let replacement_filename = 'Termdebug-gdb-console' + + call writefile(['This', 'is', 'a', 'test'], filename, 'D') + " Throw away the file once the test has done. + Termdebug + " Once termdebug has completed the startup you should have 3 windows on screen + call WaitForAssert({-> assert_equal(3, winnr('$'))}) + " A file named filename already exists in the working directory, + " hence you must call the newly created buffer differently + call WaitForAssert({-> assert_false(bufexists(filename))}) + call WaitForAssert({-> assert_true(bufexists(replacement_filename))}) + quit! + call WaitForAssert({-> assert_equal(1, winnr('$'))}) + + " Check if error message is in :message + let g:termdebug_config['disasm_window'] = 1 + let filename = 'Termdebug-asm-listing' + call writefile(['This', 'is', 'a', 'test'], filename, 'D') + " Check only the head of the error message + let error_message = "You have a file/folder named '" .. filename .. "'" + Termdebug + " Once termdebug has completed the startup you should have 4 windows on screen + call WaitForAssert({-> assert_equal(4, winnr('$'))}) + call WaitForAssert({-> assert_notequal(-1, stridx(execute('messages'), error_message))}) + quit! + wincmd b + wincmd q + call WaitForAssert({-> assert_equal(1, winnr('$'))}) + + unlet g:termdebug_config +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |