feat: Rename script.sh to source.sh

This commit is contained in:
ge
2022-05-14 17:49:46 +03:00
parent 447ae149ff
commit cbc1d68ab4
2 changed files with 124 additions and 10 deletions

View File

@ -1,6 +1,6 @@
#! /usr/bin/env bats
# source_script() from lib/script.sh tests.
# source_script() from lib/source.sh tests.
# See: https://bats-core.readthedocs.io/en/latest/index.html
setup() {
@ -16,55 +16,55 @@ setup() {
# ------------------------------ #
@test "Bad script syntax" {
. script.sh
. source.sh
run source_script $DIR/files/bad_syntax.plan
assert_output --partial 'Error: Please check your syntax'
}
@test "Empty script" {
. script.sh
. source.sh
run source_script $DIR/files/empty_script.plan
assert_output --partial 'Error: sources array is not set'
}
@test "Empty sources array" {
. script.sh
. source.sh
run source_script $DIR/files/empty_sources.plan
assert_output --partial 'Error: sources array is not set'
}
@test "Empty targets array" {
. script.sh
. source.sh
run source_script $DIR/files/empty_targets.plan
assert_output --partial 'Error: targets array is not set'
}
@test "No targets with 'file' URI scheme" {
. script.sh
. source.sh
run source_script $DIR/files/no_file_target.plan
assert_output --partial "Error: 'file' scheme is not set in targets. You must provide one or more targets with 'file' scheme."
}
@test "Unsuported source scheme" {
. script.sh
. source.sh
run source_script $DIR/files/unsupported_source_scheme.plan
assert_output --partial 'Error: Unsupported URI scheme: mongo'
}
@test "Unsuported target scheme" {
. script.sh
. source.sh
run source_script $DIR/files/unsupported_target_scheme.plan
assert_output --partial 'Error: Unsupported URI scheme: scp'
}
@test "Set local target" {
. script.sh
. source.sh
source_script $DIR/files/basic.plan
[ "$local_target" == 'file:/var/backup' ]
}
@test "Set local target from multiple 'file' targets" {
. script.sh
. source.sh
source_script $DIR/files/multiple_file_targets.plan
[ "$local_target" == 'file:///home/backups' ]
}