tests: Add more bash-it profile tests

pull/1865/head
Noah Gorny 2021-09-28 16:43:07 +03:00
parent 7fc003b7d6
commit 4c4b138671
1 changed files with 48 additions and 0 deletions

View File

@ -314,6 +314,7 @@ function local_setup {
assert_line -n 1 "Saving completion configuration..."
assert_line -n 2 "Saving aliases configuration..."
assert_line -n 3 "All done!"
assert_file_exist "$BASH_IT/profiles/test.bash_it"
}
@test "helper: profile save creates valid file with only plugin enabled" {
@ -391,6 +392,53 @@ function local_setup {
assert_line -n 1 -p "Bad line(#5) in profile, aborting load..."
}
@test "helper: profile rm sanity" {
run _bash-it-profile-save "test"
assert_file_exist "$BASH_IT/profiles/test.bash_it"
run _bash-it-profile-rm "test"
assert_line -n 0 "Removed profile \"test\" successfully!"
assert_file_not_exist "$BASH_IT/profiles/test.bash_it"
}
@test "helper: profile rm no params" {
run _bash-it-profile-rm ""
assert_line -n 0 -p "Please specify profile name to remove..."
}
@test "helper: profile load no params" {
run _bash-it-profile-load ""
assert_line -n 0 -p "Please specify profile name to load, not changing configuration..."
}
@test "helper: profile rm default" {
run _bash-it-profile-rm "default"
assert_line -n 0 -p "Can not remove the default profile..."
assert_file_exist "$BASH_IT/profiles/default.bash_it"
}
@test "helper: profile rm bad profile name" {
run _bash-it-profile-rm "notexisting"
assert_line -n 0 -p "Could not find profile \"notexisting\"..."
}
@test "helper: profile list sanity" {
run _bash-it-profile-list
assert_line -n 0 "Available profiles:"
assert_line -n 1 "default"
}
@test "helper: profile list more profiles" {
run _bash-it-profile-save "cactus"
run _bash-it-profile-save "another"
run _bash-it-profile-save "brother"
run _bash-it-profile-list
assert_line -n 0 "Available profiles:"
assert_line -n 4 "default"
assert_line -n 3 "cactus"
assert_line -n 1 "another"
assert_line -n 2 "brother"
}
@test "helpers: migrate plugins and completions that share the same name" {
ln -s $BASH_IT/completion/available/dirs.completion.bash $BASH_IT/completion/enabled/350---dirs.completion.bash
assert_link_exist "$BASH_IT/completion/enabled/350---dirs.completion.bash"