Skip to content

Commit

Permalink
Covering new command-line with Bats.
Browse files Browse the repository at this point in the history
  • Loading branch information
otaviof committed Sep 27, 2019
1 parent 03b3cce commit e0c825f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/e2e/path-helper.bats
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
#!/usr/bin/env bats

BASE_DIR="./test/paths.d"
PATH_HELPER="./build/path-helper -b $BASE_DIR"
PATH_HELPER="./build/path-helper -p $BASE_DIR -m $BASE_DIR"

PATHS="/a/a/a:/b/b/b:/c/c/c:/d/d/d"
PATHS_DUP="/a/a/a:/b/b/b:/c/c/c:/d/d/d:/d/d/d"

EXPR="PATH=\"$PATHS\" ; MANPATH=\"$PATHS\" ; export PATH MANPATH ;"
EXPR_DUP="PATH=\"$PATHS_DUP\" ; MANPATH=\"$PATHS_DUP\" ; export PATH MANPATH ;"

@test "without-duplicates-and-witout-not-founds" {
run $PATH_HELPER
[ "$status" = 0 ]
[ "$output" = "export PATH=\"\"" ]
[ "$output" = "PATH=\"\" ; MANPATH=\"\" ; export PATH MANPATH ;" ]
}

@test "with-duplicates" {
run $PATH_HELPER -s=false
[ "$status" = 0 ]
[ "$output" = "export PATH=\"\"" ]
[ "$output" = "PATH=\"\" ; MANPATH=\"\" ; export PATH MANPATH ;" ]
}

@test "with-not-founds" {
run $PATH_HELPER -d=false
[ "$status" = 0 ]
[ "$output" = "export PATH=\"/a/a/a:/b/b/b:/c/c/c:/d/d/d\"" ]
[ "$output" = "$EXPR" ]
}

@test "with-duplicates-and-with-not-founds" {
run $PATH_HELPER -s=false -d=false
[ "$status" = 0 ]
[ "$output" = "export PATH=\"/a/a/a:/b/b/b:/c/c/c:/d/d/d:/d/d/d\"" ]
[ "$output" = "$EXPR_DUP" ]
}

0 comments on commit e0c825f

Please sign in to comment.