fzf.fish: Missing argument 'exit code' argument in mock function invocation
The test is failing. The reason seems to be that the mock
function requires a [exit code]
argument before the [executed code]
argument provided.
https://github.com/matchai/fish-mock#usage
This issue appears in many places throughout the test code base.
e.g. in all the files in the tests/search_current_dir/
directory for example.
return: Argument 'echo file.txt' is not a valid integer
~/hacking/fzf.fish/tests/preview_file/custom_dir_preview.fish (line 57):
return $exit_code
^
in function 'mocked_exa_fn_.' with arguments '.'
called on line 1 of file ~/hacking/fzf.fish/tests/preview_file/custom_dir_preview.fish
in function 'exa' with arguments '.'
called on line 1 of file ~/hacking/fzf.fish/functions/__fzf_preview_file.fish
in function '__fzf_preview_file' with arguments '.'
called on line 1 of file ~/hacking/fzf.fish/tests/preview_file/custom_dir_preview.fish
in command substitution
called on line 3 of file ~/hacking/fzf.fish/tests/preview_file/custom_dir_preview.fish
(Type 'help return' for related documentation)
test: Missing argument at index 2
Standard input (line 9):
if test $argv
^
in function '@test' with arguments 'correctly\ uses\ custom\ command\ to\ preview\ directories = file.txt'
called on line 4 of file ~/hacking/fzf.fish/tests/preview_file/custom_dir_preview.fish
(Type 'help test' for related documentation)
not ok 1 correctly uses custom command to preview directories
---
operator: =
expected:
actual: file.txt
at: ~/hacking/fzf.fish/tests/preview_file/custom_dir_preview.fish:4
...
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 26 (11 by maintainers)
Commits related to this issue
- Make tests easier to debug When strings are compared using test' = operator, they need to be quoted. If they are not and a variable ends up empty, test thinks that an argument is missing and floods s... — committed to PatrickF1/fzf.fish by PatrickF1 3 years ago
- Make tests easier to debug When a fishtape @test consists of comparing two strings using test's = operator, they need to be quoted. If they are not and a variable ends up empty, both test and fishtap... — committed to PatrickF1/fzf.fish by PatrickF1 3 years ago
- Make tests easier to debug When a fishtape @test consists of comparing two strings using test's = operator, they need to be quoted. If they are not and a variable ends up empty, both test and fishtap... — committed to hrshtst/fzf.fish by PatrickF1 3 years ago
So the only remaining issue would be to make sure that
$actual
is enclosed in double quotes:https://github.com/PatrickF1/fzf.fish/blob/5ce8a51b78abf40468c96c06fd7c896bea7d05c0/tests/search_shell_variables/%24_in_curr_token.fish#L7
@test "doesn't overwrite \$ when replacing current token with selected variable" "$actual" = "\$selection"
and
https://github.com/PatrickF1/fzf.fish/blob/5ce8a51b78abf40468c96c06fd7c896bea7d05c0/tests/search_shell_variables/local_var.fish#L6
@test "can find a local variable" "$actual" = a_local_variable
Thanks a lot for your support @PatrickF1 and @jorgebucaran, I really appreciate it. Learned quite a bit about
fish
in the process.And again, my apologies for the confusion.
Oops, looks like I hadn’t updated my git repo…
After updating the repo, and with
fzf.fish
installed w/Fisher
, all tests passVery sorry about the confusion
echo "\$fd_captured_opts='$fd_captured_opts'"
As you can see, echoing
$fd_captured_opts
makes the test pass…Oops, I missed that
5.6
was released.I tested w/ that version but both tests are still failing… Also had to apply @jorgebucaran recommendation above because the tests are still broken 😉
@jorgebucaran I followed your suggestions and now the tests fails “correctly”, thank you.
@PatrickF1 now back to you re: the failing tests 😃