Refactored search test cases to use the assert functions

pull/974/head
Nils Winkler 2017-05-17 08:11:02 +02:00
parent cb46960717
commit 1e624113a7
1 changed files with 14 additions and 14 deletions

View File

@ -18,44 +18,44 @@ function local_setup {
cp -r $lib_directory/../../* $BASH_IT/
}
@test "helpers search aliases" {
@test "helpers search plugins" {
run _bash-it-search-component 'plugins' 'base'
[[ "${lines[0]}" =~ 'plugins' && "${lines[0]}" =~ 'base' ]]
}
@test "helpers search ruby gem bundle rake rails" {
# first disable them all, so that the output does not appear with a checkbox
# and we can compoare the result
# and we can compare the result
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
# Now perform the search
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails'
# And verify
[[ "${lines[0]/✓/}" == ' aliases => bundler rails' ]] && \
[[ "${lines[1]/✓/}" == ' plugins => chruby chruby-auto rails ruby' ]] && \
[[ "${lines[2]/✓/}" == ' completions => bundler gem rake' ]]
assert [ "${lines[0]/✓/}" == ' aliases => bundler rails' ]
assert [ "${lines[1]/✓/}" == ' plugins => chruby chruby-auto rails ruby' ]
assert [ "${lines[2]/✓/}" == ' completions => bundler gem rake' ]
}
@test "search ruby gem bundle -chruby rake rails" {
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
run _bash-it-search 'ruby' 'gem' 'bundle' '-chruby' 'rake' 'rails'
[[ "${lines[0]/✓/}" == ' aliases => bundler rails' ]] && \
[[ "${lines[1]/✓/}" == ' plugins => rails ruby' ]] && \
[[ "${lines[2]/✓/}" == ' completions => bundler gem rake' ]]
assert [ "${lines[0]/✓/}" == ' aliases => bundler rails' ]
assert [ "${lines[1]/✓/}" == ' plugins => rails ruby' ]
assert [ "${lines[2]/✓/}" == ' completions => bundler gem rake' ]
}
@test "search (rails enabled) ruby gem bundle rake rails" {
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
run _enable-alias 'rails'
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails'
[[ "${lines[0]}" == ' aliases => bundler ✓rails' ]] && \
[[ "${lines[1]}" == ' plugins => chruby chruby-auto rails ruby' ]] && \
[[ "${lines[2]}" == ' completions => bundler gem rake' ]]
assert_line "0" ' aliases => bundler ✓rails'
assert_line "1" ' plugins => chruby chruby-auto rails ruby'
assert_line "2" ' completions => bundler gem rake'
}
@test "search (all enabled) ruby gem bundle rake rails" {
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' '-chruby' 'rails' '--enable'
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' '-chruby' 'rails'
[[ "${lines[0]}" == ' aliases => ✓bundler ✓rails' ]] && \
[[ "${lines[1]}" == ' plugins => ✓rails ✓ruby' ]] && \
[[ "${lines[2]}" == ' completions => ✓bundler ✓gem ✓rake' ]]
assert_line "0" ' aliases => ✓bundler ✓rails'
assert_line "1" ' plugins => ✓rails ✓ruby'
assert_line "2" ' completions => ✓bundler ✓gem ✓rake'
}