diff --git a/tests/files/basic.plan b/tests/files/basic.plan index 0ac9c6b..ba043d4 100644 --- a/tests/files/basic.plan +++ b/tests/files/basic.plan @@ -1,2 +1,2 @@ sources=('file:/home/user') -targets=('file:/var/backup') +targets=('file:/etc/lvm/backup') diff --git a/tests/files/multiple_file_targets.plan b/tests/files/multiple_file_targets.plan index 974e1a5..3f62b2e 100644 --- a/tests/files/multiple_file_targets.plan +++ b/tests/files/multiple_file_targets.plan @@ -1,6 +1,6 @@ sources=('file:/home/user') targets=( - 'file:///home/backups' + 'file:///etc/lvm/backup' 'file:/var/backup' 'file:/backups' 's3://bucket' diff --git a/tests/parse_uri.bats b/tests/parse_uri.bats index f120518..b7e4b99 100644 --- a/tests/parse_uri.bats +++ b/tests/parse_uri.bats @@ -54,6 +54,19 @@ setup() { [ "$fragment" == '' ] } +@test "file:///path/with/may/sub/dir/s" { + . uri.sh + parse_uri 'file:///path/with/may/sub/dir/s' + [ "$scheme" == 'file' ] + [ "$hostname" == '' ] + [ "$port" == '' ] + [ "$path" == '/path/with/may/sub/dir/s' ] + [ "$username" == '' ] + [ "$password" == '' ] + [ "$query" == '' ] + [ "$fragment" == '' ] +} + @test "sqlite:///path" { . uri.sh parse_uri 'sqlite:///path' @@ -80,13 +93,13 @@ setup() { [ "$fragment" == '' ] } -@test "s3://host/path" { +@test "s3://bucket/backups" { . uri.sh - parse_uri 's3://host/path' + parse_uri 's3://bucket/backups' [ "$scheme" == 's3' ] - [ "$hostname" == 'host' ] + [ "$hostname" == 'bucket' ] [ "$port" == '' ] - [ "$path" == '/path' ] + [ "$path" == '/backups' ] [ "$username" == '' ] [ "$password" == '' ] [ "$query" == '' ] diff --git a/tests/source_script.bats b/tests/source_script.bats index 2ca5f12..861d8e2 100644 --- a/tests/source_script.bats +++ b/tests/source_script.bats @@ -59,12 +59,14 @@ setup() { @test "Set __main_target" { . source.sh + . uri.sh # for parse_uri() source_script $DIR/files/basic.plan - [ "$__main_target" == 'file:/var/backup' ] + [ "$__main_target" == '/etc/lvm/backup' ] } @test "Set __main_target from multiple 'file' targets" { . source.sh + . uri.sh # for parse_uri() source_script $DIR/files/multiple_file_targets.plan - [ "$__main_target" == 'file:///home/backups' ] + [ "$__main_target" == '/etc/lvm/backup' ] }