Moved to bats-assert for assert functions
This commit is contained in:
@@ -52,17 +52,17 @@ function local_setup {
|
||||
|
||||
@test "helpers: bash-it help aliases ag" {
|
||||
run bash-it help aliases "ag"
|
||||
assert_line "0" "ag='ag --smart-case --pager=\"less -MIRFX'"
|
||||
assert_line -n 0 "ag='ag --smart-case --pager=\"less -MIRFX'"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help aliases without any aliases enabled" {
|
||||
run bash-it help aliases
|
||||
assert_line "0" ""
|
||||
assert_line -n 0 ""
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help list aliases without any aliases enabled" {
|
||||
run _help-list-aliases "$BASH_IT/aliases/available/ag.aliases.bash"
|
||||
assert_line "0" "ag:"
|
||||
assert_line -n 0 "ag:"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help list aliases with ag aliases enabled" {
|
||||
@@ -70,7 +70,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/aliases/enabled/150---ag.aliases.bash" ]
|
||||
|
||||
run _help-list-aliases "$BASH_IT/aliases/enabled/150---ag.aliases.bash"
|
||||
assert_line "0" "ag:"
|
||||
assert_line -n 0 "ag:"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help list aliases with todo.txt-cli aliases enabled" {
|
||||
@@ -78,7 +78,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/aliases/enabled/150---todo.txt-cli.aliases.bash" ]
|
||||
|
||||
run _help-list-aliases "$BASH_IT/aliases/enabled/150---todo.txt-cli.aliases.bash"
|
||||
assert_line "0" "todo.txt-cli:"
|
||||
assert_line -n 0 "todo.txt-cli:"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help list aliases with docker-compose aliases enabled" {
|
||||
@@ -86,7 +86,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/aliases/enabled/150---docker-compose.aliases.bash" ]
|
||||
|
||||
run _help-list-aliases "$BASH_IT/aliases/enabled/150---docker-compose.aliases.bash"
|
||||
assert_line "0" "docker-compose:"
|
||||
assert_line -n 0 "docker-compose:"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help list aliases with ag aliases enabled in global directory" {
|
||||
@@ -94,7 +94,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/enabled/150---ag.aliases.bash" ]
|
||||
|
||||
run _help-list-aliases "$BASH_IT/enabled/150---ag.aliases.bash"
|
||||
assert_line "0" "ag:"
|
||||
assert_line -n 0 "ag:"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help aliases one alias enabled in the old directory" {
|
||||
@@ -102,50 +102,50 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/aliases/enabled/150---ag.aliases.bash" ]
|
||||
|
||||
run bash-it help aliases
|
||||
assert_line "0" "ag:"
|
||||
assert_line -n 0 "ag:"
|
||||
}
|
||||
|
||||
@test "helpers: bash-it help aliases one alias enabled in global directory" {
|
||||
run bash-it enable alias "ag"
|
||||
assert_line "0" 'ag enabled with priority 150.'
|
||||
assert_line -n 0 'ag enabled with priority 150.'
|
||||
assert [ -L "$BASH_IT/enabled/150---ag.aliases.bash" ]
|
||||
|
||||
run bash-it enable plugin "aws"
|
||||
assert_line "0" 'aws enabled with priority 250.'
|
||||
assert_line -n 0 'aws enabled with priority 250.'
|
||||
assert [ -L "$BASH_IT/enabled/250---aws.plugin.bash" ]
|
||||
|
||||
run bash-it help aliases
|
||||
assert_line "0" "ag:"
|
||||
assert_line "1" "ag='ag --smart-case --pager=\"less -MIRFX'"
|
||||
assert_line -n 0 "ag:"
|
||||
assert_line -n 1 "ag='ag --smart-case --pager=\"less -MIRFX'"
|
||||
}
|
||||
|
||||
@test "helpers: enable the todo.txt-cli aliases through the bash-it function" {
|
||||
run bash-it enable alias "todo.txt-cli"
|
||||
assert_line "0" 'todo.txt-cli enabled with priority 150.'
|
||||
assert_line -n 0 'todo.txt-cli enabled with priority 150.'
|
||||
assert [ -L "$BASH_IT/enabled/150---todo.txt-cli.aliases.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the curl aliases" {
|
||||
run _enable-alias "curl"
|
||||
assert_line "0" 'curl enabled with priority 150.'
|
||||
assert_line -n 0 'curl enabled with priority 150.'
|
||||
assert [ -L "$BASH_IT/enabled/150---curl.aliases.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the apm completion through the bash-it function" {
|
||||
run bash-it enable completion "apm"
|
||||
assert_line "0" 'apm enabled with priority 350.'
|
||||
assert_line -n 0 'apm enabled with priority 350.'
|
||||
assert [ -L "$BASH_IT/enabled/350---apm.completion.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the brew completion" {
|
||||
run _enable-completion "brew"
|
||||
assert_line "0" 'brew enabled with priority 350.'
|
||||
assert_line -n 0 'brew enabled with priority 350.'
|
||||
assert [ -L "$BASH_IT/enabled/350---brew.completion.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the node plugin" {
|
||||
run _enable-plugin "node"
|
||||
assert_line "0" 'node enabled with priority 250.'
|
||||
assert_line -n 0 'node enabled with priority 250.'
|
||||
assert [ -L "$BASH_IT/enabled/250---node.plugin.bash" ]
|
||||
|
||||
assert_equal "../plugins/available/node.plugin.bash" "`readlink $BASH_IT/enabled/250---node.plugin.bash`"
|
||||
@@ -153,34 +153,34 @@ function local_setup {
|
||||
|
||||
@test "helpers: enable the node plugin through the bash-it function" {
|
||||
run bash-it enable plugin "node"
|
||||
assert_line "0" 'node enabled with priority 250.'
|
||||
assert_line -n 0 'node enabled with priority 250.'
|
||||
assert [ -L "$BASH_IT/enabled/250---node.plugin.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the node and nvm plugins through the bash-it function" {
|
||||
run bash-it enable plugin "node" "nvm"
|
||||
assert_line "0" 'node enabled with priority 250.'
|
||||
assert_line "1" 'nvm enabled with priority 225.'
|
||||
assert_line -n 0 'node enabled with priority 250.'
|
||||
assert_line -n 1 'nvm enabled with priority 225.'
|
||||
assert [ -L "$BASH_IT/enabled/250---node.plugin.bash" ]
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the foo-unkown and nvm plugins through the bash-it function" {
|
||||
run bash-it enable plugin "foo-unknown" "nvm"
|
||||
assert_line "0" 'sorry, foo-unknown does not appear to be an available plugin.'
|
||||
assert_line "1" 'nvm enabled with priority 225.'
|
||||
assert_line -n 0 'sorry, foo-unknown does not appear to be an available plugin.'
|
||||
assert_line -n 1 'nvm enabled with priority 225.'
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable the nvm plugin" {
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm enabled with priority 225.'
|
||||
assert_line -n 0 'nvm enabled with priority 225.'
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
}
|
||||
|
||||
@test "helpers: enable an unknown plugin" {
|
||||
run _enable-plugin "unknown-foo"
|
||||
assert_line "0" 'sorry, unknown-foo does not appear to be an available plugin.'
|
||||
assert_line -n 0 'sorry, unknown-foo does not appear to be an available plugin.'
|
||||
|
||||
# Check for both old an new structure
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/250---unknown-foo.plugin.bash" ]
|
||||
@@ -193,7 +193,7 @@ function local_setup {
|
||||
@test "helpers: enable an unknown plugin through the bash-it function" {
|
||||
run bash-it enable plugin "unknown-foo"
|
||||
echo "${lines[@]}"
|
||||
assert_line "0" 'sorry, unknown-foo does not appear to be an available plugin.'
|
||||
assert_line -n 0 'sorry, unknown-foo does not appear to be an available plugin.'
|
||||
|
||||
# Check for both old an new structure
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/250---unknown-foo.plugin.bash" ]
|
||||
@@ -205,17 +205,17 @@ function local_setup {
|
||||
|
||||
@test "helpers: disable a plugin that is not enabled" {
|
||||
run _disable-plugin "sdkman"
|
||||
assert_line "0" 'sorry, sdkman does not appear to be an enabled plugin.'
|
||||
assert_line -n 0 'sorry, sdkman does not appear to be an enabled plugin.'
|
||||
}
|
||||
|
||||
@test "helpers: enable and disable the nvm plugin" {
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm enabled with priority 225.'
|
||||
assert_line -n 0 'nvm enabled with priority 225.'
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/225---nvm.plugin.bash" ]
|
||||
|
||||
run _disable-plugin "nvm"
|
||||
assert_line "0" 'nvm disabled.'
|
||||
assert_line -n 0 'nvm disabled.'
|
||||
assert [ ! -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ function local_setup {
|
||||
assert [ ! -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
|
||||
run _disable-plugin "nvm"
|
||||
assert_line "0" 'nvm disabled.'
|
||||
assert_line -n 0 'nvm disabled.'
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ ! -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
}
|
||||
@@ -235,7 +235,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
|
||||
run _disable-plugin "nvm"
|
||||
assert_line "0" 'nvm disabled.'
|
||||
assert_line -n 0 'nvm disabled.'
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm is already enabled.'
|
||||
assert_line -n 0 'nvm is already enabled.'
|
||||
assert [ -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ ! -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
@@ -255,7 +255,7 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/plugins/enabled/225---nvm.plugin.bash" ]
|
||||
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm is already enabled.'
|
||||
assert_line -n 0 'nvm is already enabled.'
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
assert [ -L "$BASH_IT/plugins/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ ! -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
@@ -263,11 +263,11 @@ function local_setup {
|
||||
|
||||
@test "helpers: enable the nvm plugin twice" {
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm enabled with priority 225.'
|
||||
assert_line -n 0 'nvm enabled with priority 225.'
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm is already enabled.'
|
||||
assert_line -n 0 'nvm is already enabled.'
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
}
|
||||
|
||||
@@ -279,13 +279,13 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/plugins/enabled/250---dirs.plugin.bash" ]
|
||||
|
||||
run _bash-it-migrate
|
||||
assert_line "0" 'Migrating plugin dirs.'
|
||||
assert_line "1" 'dirs disabled.'
|
||||
assert_line "2" 'dirs enabled with priority 250.'
|
||||
assert_line "3" 'Migrating completion dirs.'
|
||||
assert_line "4" 'dirs disabled.'
|
||||
assert_line "5" 'dirs enabled with priority 350.'
|
||||
assert_line "6" 'If any migration errors were reported, please try the following: reload && bash-it migrate'
|
||||
assert_line -n 0 'Migrating plugin dirs.'
|
||||
assert_line -n 1 'dirs disabled.'
|
||||
assert_line -n 2 'dirs enabled with priority 250.'
|
||||
assert_line -n 3 'Migrating completion dirs.'
|
||||
assert_line -n 4 'dirs disabled.'
|
||||
assert_line -n 5 'dirs enabled with priority 350.'
|
||||
assert_line -n 6 'If any migration errors were reported, please try the following: reload && bash-it migrate'
|
||||
|
||||
assert [ -L "$BASH_IT/enabled/350---dirs.completion.bash" ]
|
||||
assert [ -L "$BASH_IT/enabled/250---dirs.plugin.bash" ]
|
||||
@@ -307,9 +307,9 @@ function local_setup {
|
||||
assert [ -L "$BASH_IT/enabled/250---ssh.plugin.bash" ]
|
||||
|
||||
run _bash-it-migrate
|
||||
assert_line "0" 'Migrating alias todo.txt-cli.'
|
||||
assert_line "1" 'todo.txt-cli disabled.'
|
||||
assert_line "2" 'todo.txt-cli enabled with priority 150.'
|
||||
assert_line -n 0 'Migrating alias todo.txt-cli.'
|
||||
assert_line -n 1 'todo.txt-cli disabled.'
|
||||
assert_line -n 2 'todo.txt-cli enabled with priority 150.'
|
||||
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ -L "$BASH_IT/enabled/250---node.plugin.bash" ]
|
||||
@@ -433,11 +433,11 @@ function __migrate_all_components() {
|
||||
assert [ -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
|
||||
run bash-it enable plugin "node"
|
||||
assert_line "0" 'Migrating plugin nvm.'
|
||||
assert_line "1" 'nvm disabled.'
|
||||
assert_line "2" 'nvm enabled with priority 225.'
|
||||
assert_line "3" 'If any migration errors were reported, please try the following: reload && bash-it migrate'
|
||||
assert_line "4" 'node enabled with priority 250.'
|
||||
assert_line -n 0 'Migrating plugin nvm.'
|
||||
assert_line -n 1 'nvm disabled.'
|
||||
assert_line -n 2 'nvm enabled with priority 225.'
|
||||
assert_line -n 3 'If any migration errors were reported, please try the following: reload && bash-it migrate'
|
||||
assert_line -n 4 'node enabled with priority 250.'
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ -L "$BASH_IT/enabled/250---node.plugin.bash" ]
|
||||
@@ -450,14 +450,14 @@ function __migrate_all_components() {
|
||||
assert [ -L "$BASH_IT/plugins/enabled/250---node.plugin.bash" ]
|
||||
|
||||
run bash-it disable plugin "node"
|
||||
assert_line "0" 'Migrating plugin node.'
|
||||
assert_line "1" 'node disabled.'
|
||||
assert_line "2" 'node enabled with priority 250.'
|
||||
assert_line "3" 'Migrating plugin nvm.'
|
||||
assert_line "4" 'nvm disabled.'
|
||||
assert_line "5" 'nvm enabled with priority 225.'
|
||||
assert_line "6" 'If any migration errors were reported, please try the following: reload && bash-it migrate'
|
||||
assert_line "7" 'node disabled.'
|
||||
assert_line -n 0 'Migrating plugin node.'
|
||||
assert_line -n 1 'node disabled.'
|
||||
assert_line -n 2 'node enabled with priority 250.'
|
||||
assert_line -n 3 'Migrating plugin nvm.'
|
||||
assert_line -n 4 'nvm disabled.'
|
||||
assert_line -n 5 'nvm enabled with priority 225.'
|
||||
assert_line -n 6 'If any migration errors were reported, please try the following: reload && bash-it migrate'
|
||||
assert_line -n 7 'node disabled.'
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/nvm.plugin.bash" ]
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
assert [ ! -L "$BASH_IT/plugins/enabled/250---node.plugin.bash" ]
|
||||
@@ -539,7 +539,7 @@ function __migrate_all_components() {
|
||||
|
||||
@test "helpers: enable the ansible aliases through the bash-it function" {
|
||||
run bash-it enable alias "ansible"
|
||||
assert_line "0" 'ansible enabled with priority 150.'
|
||||
assert_line -n 0 'ansible enabled with priority 150.'
|
||||
assert [ -L "$BASH_IT/enabled/150---ansible.aliases.bash" ]
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ function __migrate_all_components() {
|
||||
|
||||
@test "helpers: describe the nvm plugin after enabling it" {
|
||||
run _enable-plugin "nvm"
|
||||
assert_line "0" 'nvm enabled with priority 225.'
|
||||
assert_line -n 0 'nvm enabled with priority 225.'
|
||||
assert [ -L "$BASH_IT/enabled/225---nvm.plugin.bash" ]
|
||||
|
||||
_bash-it-plugins | grep "nvm" | grep "\[x\]"
|
||||
|
||||
@@ -54,15 +54,15 @@ function local_setup {
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails' '--disable'
|
||||
run _enable-alias 'rails'
|
||||
run _bash-it-search 'ruby' 'gem' 'bundle' 'rake' 'rails'
|
||||
assert_line "0" ' aliases => bundler ✓rails'
|
||||
assert_line "1" ' plugins => chruby chruby-auto rails ruby'
|
||||
assert_line "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: (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'
|
||||
assert_line "0" ' aliases => ✓bundler ✓rails'
|
||||
assert_line "1" ' plugins => ✓rails ✓ruby'
|
||||
assert_line "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'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user