From 262a39b4dc9747f28a08c0fc5868fe31c7cb96ae Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 17:24:56 +0800 Subject: [PATCH 01/20] [Search files] expand entire token --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index bcc2458c..d2db6a0a 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -8,7 +8,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set current_token (commandline --current-token) set token (string unescape -- $current_token) # need to expand ~ in the directory name since fd can't expand it - set expanded_token (string replace --regex -- "^~/" $HOME/ $token) + set expanded_token (eval "printf $token") # If the current token is a directory and has a trailing slash, # then use it as fd's base directory. From 05dffd1a8e758ae571708e381b47348382c9bd33 Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 17:31:54 +0800 Subject: [PATCH 02/20] That thing --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index d2db6a0a..3a900d3b 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -8,7 +8,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set current_token (commandline --current-token) set token (string unescape -- $current_token) # need to expand ~ in the directory name since fd can't expand it - set expanded_token (eval "printf $token") + set expanded_token (eval "printf -- $token") # If the current token is a directory and has a trailing slash, # then use it as fd's base directory. From 2e29c3e76531c82cfe92d3a4c1a6bb3087645f1d Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 18:25:55 +0800 Subject: [PATCH 03/20] Use expaned token in the preview --- functions/__fzf_search_current_dir.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 3a900d3b..43161135 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -7,7 +7,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set fzf_arguments --multi --ansi set current_token (commandline --current-token) set token (string unescape -- $current_token) - # need to expand ~ in the directory name since fd can't expand it + # expand the token (for tilde, variables, etc.) into full path set expanded_token (eval "printf -- $token") # If the current token is a directory and has a trailing slash, @@ -15,7 +15,7 @@ function __fzf_search_current_dir --description "Search the current directory. R if string match --quiet -- "*/" $token && test -d $expanded_token set --append fd_opts --base-directory=$expanded_token # use the directory name as fzf's prompt to indicate the search is limited to that directory - set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $token{}" + set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $expanded_token{}" set file_paths_selected $expanded_token(fd $fd_opts 2>/dev/null | fzf $fzf_arguments) else set --append fzf_arguments --query=$token --preview='__fzf_preview_file {}' From b6b60bdf818d6ba0455da5e3691de5d9d00f3545 Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 18:49:00 +0800 Subject: [PATCH 04/20] Fix escaping --- functions/__fzf_search_current_dir.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 43161135..08c3e722 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -8,14 +8,15 @@ function __fzf_search_current_dir --description "Search the current directory. R set current_token (commandline --current-token) set token (string unescape -- $current_token) # expand the token (for tilde, variables, etc.) into full path - set expanded_token (eval "printf -- $token") + set expanded_token (eval "echo -- $token") + set escaped_expanded_token (string escape -- $expanded_token) # If the current token is a directory and has a trailing slash, # then use it as fd's base directory. if string match --quiet -- "*/" $token && test -d $expanded_token set --append fd_opts --base-directory=$expanded_token # use the directory name as fzf's prompt to indicate the search is limited to that directory - set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $expanded_token{}" + set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $escaped_expanded_token{}" set file_paths_selected $expanded_token(fd $fd_opts 2>/dev/null | fzf $fzf_arguments) else set --append fzf_arguments --query=$token --preview='__fzf_preview_file {}' From e24052f1b56db82658bf78a82fb7c96f5f78f28e Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 19:23:04 +0800 Subject: [PATCH 05/20] eval is evil --- functions/__fzf_preview_file.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_preview_file.fish b/functions/__fzf_preview_file.fish index 997c8317..e63b0217 100644 --- a/functions/__fzf_preview_file.fish +++ b/functions/__fzf_preview_file.fish @@ -4,7 +4,7 @@ function __fzf_preview_file --argument-names file_path --description "Print a pr bat --style=numbers --color=always "$file_path" else if test -d "$file_path" # directory if set --query fzf_preview_dir_cmd - eval $fzf_preview_dir_cmd "$file_path" + command $fzf_preview_dir_cmd "$file_path" else # -A list hidden files as well, except for . and .. # -F helps classify files by appending symbols after the file name From ecbe926fd89889d720740a495c47a12c56f880fd Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 19:40:41 +0800 Subject: [PATCH 06/20] Try to fix test --- tests/preview_file/custom_dir_preview.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/preview_file/custom_dir_preview.fish b/tests/preview_file/custom_dir_preview.fish index d594d8b9..6ec7fb3c 100644 --- a/tests/preview_file/custom_dir_preview.fish +++ b/tests/preview_file/custom_dir_preview.fish @@ -1,4 +1,4 @@ -set fzf_preview_dir_cmd exa -mock exa . "echo file.txt" +set fzf_preview_dir_cmd ls +touch file.txt .hidden set actual (__fzf_preview_file .) @test "correctly uses custom command to preview directories" "$actual" = file.txt From 231ec290f9a5bb3cef42b3cf6d03909affca0ce1 Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 19:44:50 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=F0=9F=A4=B7=E2=80=8D=E2=99=80=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/preview_file/custom_dir_preview.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/preview_file/custom_dir_preview.fish b/tests/preview_file/custom_dir_preview.fish index 6ec7fb3c..36f53c62 100644 --- a/tests/preview_file/custom_dir_preview.fish +++ b/tests/preview_file/custom_dir_preview.fish @@ -1,4 +1,5 @@ set fzf_preview_dir_cmd ls -touch file.txt .hidden -set actual (__fzf_preview_file .) +set dir (mkdtemp -d) +touch $dir/{file.txt,.hidden} +set actual (__fzf_preview_file $dir) @test "correctly uses custom command to preview directories" "$actual" = file.txt From b87a24b33e20b27ddb5bdee97a2094bba152573f Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 19:51:52 +0800 Subject: [PATCH 08/20] fix typo --- tests/preview_file/custom_dir_preview.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/preview_file/custom_dir_preview.fish b/tests/preview_file/custom_dir_preview.fish index 36f53c62..d2453f9d 100644 --- a/tests/preview_file/custom_dir_preview.fish +++ b/tests/preview_file/custom_dir_preview.fish @@ -1,5 +1,5 @@ set fzf_preview_dir_cmd ls -set dir (mkdtemp -d) +set dir (mktemp -d) touch $dir/{file.txt,.hidden} set actual (__fzf_preview_file $dir) @test "correctly uses custom command to preview directories" "$actual" = file.txt From 5fa321b295d16c32c0a87d516b5e2361bdd5c4f2 Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 9 Mar 2021 20:06:09 +0800 Subject: [PATCH 09/20] Save a escape --- functions/__fzf_preview_file.fish | 3 ++- functions/__fzf_search_current_dir.fish | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/__fzf_preview_file.fish b/functions/__fzf_preview_file.fish index e63b0217..ba632ed2 100644 --- a/functions/__fzf_preview_file.fish +++ b/functions/__fzf_preview_file.fish @@ -1,5 +1,6 @@ # helper function for __fzf_search_current_dir -function __fzf_preview_file --argument-names file_path --description "Print a preview for the given file based on its file type." +function __fzf_preview_file --description "Print a preview for the given file based on its file type." + set file_path $argv if test -f "$file_path" # regular file bat --style=numbers --color=always "$file_path" else if test -d "$file_path" # directory diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 08c3e722..e5c99baa 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -9,14 +9,13 @@ function __fzf_search_current_dir --description "Search the current directory. R set token (string unescape -- $current_token) # expand the token (for tilde, variables, etc.) into full path set expanded_token (eval "echo -- $token") - set escaped_expanded_token (string escape -- $expanded_token) # If the current token is a directory and has a trailing slash, # then use it as fd's base directory. if string match --quiet -- "*/" $token && test -d $expanded_token set --append fd_opts --base-directory=$expanded_token # use the directory name as fzf's prompt to indicate the search is limited to that directory - set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $escaped_expanded_token{}" + set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $expanded_token{}" set file_paths_selected $expanded_token(fd $fd_opts 2>/dev/null | fzf $fzf_arguments) else set --append fzf_arguments --query=$token --preview='__fzf_preview_file {}' From eeedadb74cafc365a2ee17abb29b10241bf05514 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Tue, 9 Mar 2021 20:08:23 +0800 Subject: [PATCH 10/20] Update __fzf_search_current_dir.fish --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index e5c99baa..1ca37824 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -7,7 +7,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set fzf_arguments --multi --ansi set current_token (commandline --current-token) set token (string unescape -- $current_token) - # expand the token (for tilde, variables, etc.) into full path + # expand the token (which may include tilde, variables, etc.) into full path set expanded_token (eval "echo -- $token") # If the current token is a directory and has a trailing slash, From b4b4186a700b96684ff5686d07955318af7980bd Mon Sep 17 00:00:00 2001 From: Kid Date: Sun, 14 Mar 2021 15:07:26 +0800 Subject: [PATCH 11/20] Escape properly --- functions/__fzf_preview_file.fish | 5 ++--- tests/preview_file/custom_dir_preview.fish | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/functions/__fzf_preview_file.fish b/functions/__fzf_preview_file.fish index ba632ed2..d5f8f966 100644 --- a/functions/__fzf_preview_file.fish +++ b/functions/__fzf_preview_file.fish @@ -1,11 +1,10 @@ # helper function for __fzf_search_current_dir -function __fzf_preview_file --description "Print a preview for the given file based on its file type." - set file_path $argv +function __fzf_preview_file --argument-names file_path --description "Print a preview for the given file based on its file type." if test -f "$file_path" # regular file bat --style=numbers --color=always "$file_path" else if test -d "$file_path" # directory if set --query fzf_preview_dir_cmd - command $fzf_preview_dir_cmd "$file_path" + eval $fzf_preview_dir_cmd \"$file_path\" else # -A list hidden files as well, except for . and .. # -F helps classify files by appending symbols after the file name diff --git a/tests/preview_file/custom_dir_preview.fish b/tests/preview_file/custom_dir_preview.fish index d2453f9d..d594d8b9 100644 --- a/tests/preview_file/custom_dir_preview.fish +++ b/tests/preview_file/custom_dir_preview.fish @@ -1,5 +1,4 @@ -set fzf_preview_dir_cmd ls -set dir (mktemp -d) -touch $dir/{file.txt,.hidden} -set actual (__fzf_preview_file $dir) +set fzf_preview_dir_cmd exa +mock exa . "echo file.txt" +set actual (__fzf_preview_file .) @test "correctly uses custom command to preview directories" "$actual" = file.txt From f81af5270b07d70367c0995524250cb5033deac0 Mon Sep 17 00:00:00 2001 From: Kid Date: Sun, 14 Mar 2021 15:10:31 +0800 Subject: [PATCH 12/20] Quote the new eval as well --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 1ca37824..1e96c569 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -8,7 +8,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set current_token (commandline --current-token) set token (string unescape -- $current_token) # expand the token (which may include tilde, variables, etc.) into full path - set expanded_token (eval "echo -- $token") + set expanded_token (eval echo -- \"$token\") # If the current token is a directory and has a trailing slash, # then use it as fd's base directory. From 43d131f62645dbc8be7b37295e91298a53ed0d8e Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 23 Mar 2021 11:13:48 +0800 Subject: [PATCH 13/20] Merge --- functions/__fzf_preview_file.fish | 1 + functions/__fzf_search_current_dir.fish | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/functions/__fzf_preview_file.fish b/functions/__fzf_preview_file.fish index 38ff2dca..ac1be57e 100644 --- a/functions/__fzf_preview_file.fish +++ b/functions/__fzf_preview_file.fish @@ -4,6 +4,7 @@ function __fzf_preview_file --argument-names file_path --description "Print a pr bat --style=numbers --color=always "$file_path" else if test -d "$file_path" # directory if set --query fzf_preview_dir_cmd + # need to escape quotes to make sure eval receives file_path as a single arg eval $fzf_preview_dir_cmd \"$file_path\" else # -A list hidden files as well, except for . and .. diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index c9fe4ef3..4e943dfa 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -5,18 +5,19 @@ function __fzf_search_current_dir --description "Search the current directory. R set fd_opts --color=always $fzf_fd_opts set fzf_arguments --multi --ansi - set current_token (commandline --current-token) - set token (string unescape -- $current_token) - # expand the token (which may include tilde, variables, etc.) into full path + set token (commandline --current-token) + # expand ~ in the directory name since fd can't expand it set expanded_token (eval echo -- \"$token\") + # unescape token because it's already quoted so backslashes will mess up the path + set unescaped_exp_token (string unescape -- $expanded_token) # If the current token is a directory and has a trailing slash, # then use it as fd's base directory. if string match --quiet -- "*/" $token && test -d "$unescaped_exp_token" set --append fd_opts --base-directory=$unescaped_exp_token # use the directory name as fzf's prompt to indicate the search is limited to that directory - set --append fzf_arguments --prompt=$token --preview="__fzf_preview_file $expanded_token{}" - set file_paths_selected $expanded_token(fd $fd_opts 2>/dev/null | fzf $fzf_arguments) + set --append fzf_arguments --prompt="$unescaped_exp_token" --preview="__fzf_preview_file $expanded_token{}" + set file_paths_selected $unescaped_exp_token(fd $fd_opts 2>/dev/null | fzf $fzf_arguments) else set --append fzf_arguments --query="$unescaped_exp_token" --preview='__fzf_preview_file {}' set file_paths_selected (fd $fd_opts 2>/dev/null | fzf $fzf_arguments) From 931c0528f1da58b5458d0c49a605e12d69e99834 Mon Sep 17 00:00:00 2001 From: Kid Date: Tue, 23 Mar 2021 11:14:15 +0800 Subject: [PATCH 14/20] Fix space --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 4e943dfa..24523efc 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -5,7 +5,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set fd_opts --color=always $fzf_fd_opts set fzf_arguments --multi --ansi - set token (commandline --current-token) + set token (commandline --current-token) # expand ~ in the directory name since fd can't expand it set expanded_token (eval echo -- \"$token\") # unescape token because it's already quoted so backslashes will mess up the path From 78c43a75d6cc3c798e840c583c74315bc5032538 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:30:10 +0800 Subject: [PATCH 15/20] Update __fzf_search_current_dir.fish --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 24523efc..210586e9 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -6,7 +6,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set fd_opts --color=always $fzf_fd_opts set fzf_arguments --multi --ansi set token (commandline --current-token) - # expand ~ in the directory name since fd can't expand it + ​#​ expand the token (which may include tilde, variables, etc.) into full path set expanded_token (eval echo -- \"$token\") # unescape token because it's already quoted so backslashes will mess up the path set unescaped_exp_token (string unescape -- $expanded_token) From 5f30c495795f111ebd5297a284b4488ef537762e Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:37:30 +0800 Subject: [PATCH 16/20] Update __fzf_search_current_dir.fish --- functions/__fzf_search_current_dir.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/__fzf_search_current_dir.fish b/functions/__fzf_search_current_dir.fish index 210586e9..02b04ba3 100644 --- a/functions/__fzf_search_current_dir.fish +++ b/functions/__fzf_search_current_dir.fish @@ -6,7 +6,7 @@ function __fzf_search_current_dir --description "Search the current directory. R set fd_opts --color=always $fzf_fd_opts set fzf_arguments --multi --ansi set token (commandline --current-token) - ​#​ expand the token (which may include tilde, variables, etc.) into full path + ​# expand the token (which may include tilde, variables, etc.) into full path set expanded_token (eval echo -- \"$token\") # unescape token because it's already quoted so backslashes will mess up the path set unescaped_exp_token (string unescape -- $expanded_token) From 0b8975b81ee8b383c552ec8b9fd603bfff3e9973 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Mon, 22 Mar 2021 23:47:01 -0700 Subject: [PATCH 17/20] start test --- tests/search_current_dir/expands_vars.fish | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/search_current_dir/expands_vars.fish diff --git a/tests/search_current_dir/expands_vars.fish b/tests/search_current_dir/expands_vars.fish new file mode 100644 index 00000000..da8fbd77 --- /dev/null +++ b/tests/search_current_dir/expands_vars.fish @@ -0,0 +1,9 @@ +set target "file 1.txt" + +set --global --export fzf_dir_opts --filter="" +mock commandline --current-token "echo \$target" +mock commandline "--current-token --replace" "echo \$argv" +mock commandline \* "" + +set actual (__fzf_search_current_dir) +@test "expands variables in current token" "$actual" = "file 1.txt" From 62b26e194f880ab6b46051a82d90b450b6c88247 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Mon, 22 Mar 2021 23:51:08 -0700 Subject: [PATCH 18/20] work on new test --- tests/search_current_dir/expands_vars.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/search_current_dir/expands_vars.fish b/tests/search_current_dir/expands_vars.fish index da8fbd77..362e94fe 100644 --- a/tests/search_current_dir/expands_vars.fish +++ b/tests/search_current_dir/expands_vars.fish @@ -1,9 +1,9 @@ set target "file 1.txt" -set --global --export fzf_dir_opts --filter="" +set --global fzf_dir_opts --select-1 mock commandline --current-token "echo \$target" -mock commandline "--current-token --replace" "echo \$argv" +mock commandline "--current-token --replace --" "echo \$argv" mock commandline \* "" set actual (__fzf_search_current_dir) -@test "expands variables in current token" "$actual" = "file 1.txt" +@test "expands variables in current token" (basename "$actual") = "file 1.txt" From 62d97cd6904d96553b31a9c847bb4070c7d8c58e Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Tue, 23 Mar 2021 09:08:41 -0700 Subject: [PATCH 19/20] finish test --- tests/search_current_dir/expands_var_in_query.fish | 10 ++++++++++ tests/search_current_dir/expands_vars.fish | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 tests/search_current_dir/expands_var_in_query.fish delete mode 100644 tests/search_current_dir/expands_vars.fish diff --git a/tests/search_current_dir/expands_var_in_query.fish b/tests/search_current_dir/expands_var_in_query.fish new file mode 100644 index 00000000..09388eed --- /dev/null +++ b/tests/search_current_dir/expands_var_in_query.fish @@ -0,0 +1,10 @@ +set target "file 1.txt" + +set --global fzf_dir_opts --select-1 +mock commandline --current-token "echo \$target" +mock commandline "--current-token --replace --" "echo \$argv" +mock commandline \* "" +# string unescape because the args passed into commandline --current-token --replace are escaped +set actual (string unescape (__fzf_search_current_dir)) + +@test "expands variables in current token" (basename $actual) = $target diff --git a/tests/search_current_dir/expands_vars.fish b/tests/search_current_dir/expands_vars.fish deleted file mode 100644 index 362e94fe..00000000 --- a/tests/search_current_dir/expands_vars.fish +++ /dev/null @@ -1,9 +0,0 @@ -set target "file 1.txt" - -set --global fzf_dir_opts --select-1 -mock commandline --current-token "echo \$target" -mock commandline "--current-token --replace --" "echo \$argv" -mock commandline \* "" - -set actual (__fzf_search_current_dir) -@test "expands variables in current token" (basename "$actual") = "file 1.txt" From d8d3f1e7139ba36b7648441e19e1d32dbbae8806 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Tue, 23 Mar 2021 09:12:00 -0700 Subject: [PATCH 20/20] add timeout to tests --- .github/workflows/continuous_integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 1d258279..801b997e 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -29,6 +29,8 @@ jobs: - name: Run full test suite run: fishtape tests/*/*.fish shell: fish {0} + # timeout in case tests get stuck on fzf + timeout-minutes: 3 syntax-check: runs-on: ubuntu-latest