patch 9.1.0857: xxd: --- is incorrectly recognized as end-of-options
Problem: xxd: --- is incorrectly recognized as end-of-options
Solution: improve xxds end-of-option parser (DungSaga)
closes: #9285
Signed-off-by: DungSaga <dungsaga@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index f10c244..690c8da 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -356,7 +356,7 @@
" Various ways with wrong arguments that trigger the usage output.
func Test_xxd_usage()
- for arg in ['-h', '-c', '-g', '-o', '-s', '-l', '-X', '-R', 'one two three']
+ for arg in ['-h', '-c', '-g', '-o', '-s', '-l', '-X', '-R', 'one two three', '----', '---']
new
exe 'r! ' . s:xxd_cmd . ' ' . arg
call assert_match("Usage:", join(getline(1, 3)))
@@ -364,6 +364,13 @@
endfor
endfunc
+func Test_xxd_end_of_options()
+ new
+ exe 'r! ' . s:xxd_cmd . ' -- random-file-' . rand()
+ call assert_match('random-file-.*: No such file or directory', join(getline(1, 3)))
+ bwipe!
+endfunc
+
func Test_xxd_ignore_garbage()
new
exe 'r! printf "\n\r xxxx 0: 42 42" | ' . s:xxd_cmd . ' -r'