-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return status
1
from _file_is_text()
when path is blank or nonexi…
…stent. refs gh-304
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bats | ||
|
||
load test_helper | ||
|
||
@test "'_file_is_text()' returns status 0 for text file." { | ||
run "${_NB}" helpers file_is_text "${NB_TEST_BASE_PATH}/example.asciidoc" | ||
|
||
printf "\${status}: '%s'\\n" "${status}" | ||
printf "\${output}: '%s'\\n" "${output}" | ||
|
||
[[ "${status}" -eq 0 ]] | ||
[[ -z "${output}" ]] | ||
} | ||
|
||
@test "'_file_is_text()' returns status 1 for pdf file." { | ||
run "${_NB}" helpers file_is_text "${NB_TEST_BASE_PATH}/example.pdf" | ||
|
||
printf "\${status}: '%s'\\n" "${status}" | ||
printf "\${output}: '%s'\\n" "${output}" | ||
|
||
[[ "${status}" -eq 1 ]] | ||
[[ -z "${output}" ]] | ||
} | ||
|
||
@test "'_file_is_text()' returns status 1 for nonexistent file." { | ||
run "${_NB}" helpers file_is_text "${NB_TEST_BASE_PATH}/nonexistent" | ||
|
||
printf "\${status}: '%s'\\n" "${status}" | ||
printf "\${output}: '%s'\\n" "${output}" | ||
|
||
[[ "${status}" -eq 1 ]] | ||
[[ -z "${output}" ]] | ||
} | ||
|
||
@test "'_file_is_text()' returns status 1 for blank file path." { | ||
run "${_NB}" helpers file_is_text "" | ||
|
||
printf "\${status}: '%s'\\n" "${status}" | ||
printf "\${output}: '%s'\\n" "${output}" | ||
|
||
[[ "${status}" -eq 1 ]] | ||
[[ -z "${output}" ]] | ||
} |