lib/search: code cleanup
Improve `_bash-it-erase-term()`, `_bash-it-flash-term()`, `_bash-it-rewind()`, `_bash-it-search-result()`, and `_bash-it-search-component()`. Minor tweaks to `_bash-it-is-partial-match()`, and `_bash-it-search()`.
This commit is contained in:
30
test/lib/search.bats
Normal file → Executable file
30
test/lib/search.bats
Normal file → Executable file
@@ -28,42 +28,42 @@ function local_teardown {
|
||||
@test "search: plugin base" {
|
||||
export BASH_IT_SEARCH_USE_COLOR=false
|
||||
run _bash-it-search-component 'plugins' 'base'
|
||||
assert_line -n 0 ' plugins: base '
|
||||
assert_line -n 0 ' plugins: base '
|
||||
}
|
||||
|
||||
@test "search: git" {
|
||||
run _bash-it-search 'git' --no-color
|
||||
assert_line -n 0 ' aliases: git gitsvn '
|
||||
assert_line -n 0 ' aliases: git gitsvn '
|
||||
assert_line -n 1 -p ' plugins:'
|
||||
for plugin in "autojump" "git" "gitstatus" "git-subrepo" "jgitflow" "jump"
|
||||
do
|
||||
echo $plugin
|
||||
assert_line -n 1 -p $plugin
|
||||
done
|
||||
assert_line -n 2 ' completions: git git_flow git_flow_avh github-cli '
|
||||
assert_line -n 2 ' completions: git git_flow git_flow_avh github-cli '
|
||||
}
|
||||
|
||||
@test "search: ruby gem bundle rake rails" {
|
||||
run _bash-it-search rails ruby gem bundler rake --no-color
|
||||
|
||||
assert_line -n 0 ' aliases: bundler rails '
|
||||
assert_line -n 1 ' plugins: chruby chruby-auto rails ruby '
|
||||
assert_line -n 2 ' completions: bundler gem rake '
|
||||
assert_line -n 0 ' aliases: bundler rails '
|
||||
assert_line -n 1 ' plugins: chruby chruby-auto rails ruby '
|
||||
assert_line -n 2 ' completions: bundler gem rake '
|
||||
}
|
||||
|
||||
@test "search: rails ruby gem bundler rake -chruby" {
|
||||
run _bash-it-search rails ruby gem bundler rake -chruby --no-color
|
||||
|
||||
assert_line -n 0 ' aliases: bundler rails '
|
||||
assert_line -n 1 ' plugins: rails ruby '
|
||||
assert_line -n 2 ' completions: bundler gem rake '
|
||||
assert_line -n 0 ' aliases: bundler rails '
|
||||
assert_line -n 1 ' plugins: rails ruby '
|
||||
assert_line -n 2 ' completions: bundler gem rake '
|
||||
}
|
||||
|
||||
@test "search: @git" {
|
||||
run _bash-it-search '@git' --no-color
|
||||
assert_line -n 0 ' aliases: git '
|
||||
assert_line -n 1 ' plugins: git '
|
||||
assert_line -n 2 ' completions: git '
|
||||
assert_line -n 0 ' aliases: git '
|
||||
assert_line -n 1 ' plugins: git '
|
||||
assert_line -n 2 ' completions: git '
|
||||
}
|
||||
|
||||
@test "search: @git --enable / --disable" {
|
||||
@@ -76,7 +76,7 @@ function local_teardown {
|
||||
run _bash-it-search '@git' --disable --no-color
|
||||
run _bash-it-search '@git' --no-color
|
||||
|
||||
assert_line -n 0 ' aliases: git '
|
||||
assert_line -n 1 ' plugins: git '
|
||||
assert_line -n 2 ' completions: git '
|
||||
assert_line -n 0 ' aliases: git '
|
||||
assert_line -n 1 ' plugins: git '
|
||||
assert_line -n 2 ' completions: git '
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user