Hi,
The test Test_cmdline_complete_user_names() failed on my machine because it
assumes that the current username's first letter is unique, which not the case
on my machine:
if has('unix') && executable('whoami')
let whoami = systemlist('whoami')[0]
let first_letter = whoami[0]
if len(first_letter) > 0
" Trying completion of :e ~x where x is the first letter of
" the user name should complete to at least the user name.
call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx')
call assert_match('^"e \~.*\<' . whoami . '\>', @:)
endif
endif
If the current username is "foo" and there exist another username "f", then the
test would fail because "':e ~' . first_letter" would expand to "/home/f"
instead of what the test expects which is "/home/foo".
Perhaps taking most of the username would be a better approach? Although it can
still fail on a system where there are two usernames where the only difference
between them is the last letter, for example "foo" and "foa".
$ git diff src/testdir/test_cmdline.vim
diff --git src/testdir/test_cmdline.vim src/testdir/test_cmdline.vim
index 26d33d838..5874f72cd 100644
--- src/testdir/test_cmdline.vim
+++ src/testdir/test_cmdline.vim
@@ -394,11 +394,11 @@ endfunc
func Test_cmdline_complete_user_names()
if has('unix') && executable('whoami')
let whoami = systemlist('whoami')[0]
- let first_letter = whoami[0]
- if len(first_letter) > 0
+ let a_letter_short = whoami[0:-2]
+ if len(a_letter_short) > 0
" Trying completion of :e ~x where x is the first letter of
" the user name should complete to at least the user name.
- call feedkeys(':e ~' . first_letter . "\<c-a>\<c-B>\"\<cr>", 'tx')
+ call feedkeys(':e ~' . a_letter_short . "\<c-a>\<c-B>\"\<cr>", 'tx')
call assert_match('^"e \~.*\<' . whoami . '\>', @:)
endif
endif
Nazri
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.