-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
261 additions
and
352 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,3 @@ | ||
# Awesome-CI test cases | ||
|
||
This directory contains test cases for awesome-ci. |
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,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
|
||
### | ||
### Define Paths | ||
### | ||
GIT_PATH="$( cd "$(dirname "$0")" ; pwd -P )/.." | ||
RUN_PATH="${GIT_PATH}/test/test_single.sh" | ||
|
||
|
||
${RUN_PATH} file-cr | ||
${RUN_PATH} file-crlf | ||
${RUN_PATH} file-empty | ||
${RUN_PATH} file-nullbyte-char | ||
${RUN_PATH} file-trailing-newline | ||
${RUN_PATH} file-trailing-single-newline | ||
${RUN_PATH} file-trailing-space | ||
${RUN_PATH} file-utf8 | ||
${RUN_PATH} file-utf8-bom | ||
${RUN_PATH} git-conflicts | ||
${RUN_PATH} git-ignored | ||
${RUN_PATH} inline-css | ||
${RUN_PATH} inline-js | ||
${RUN_PATH} regex-grep | ||
${RUN_PATH} regex-perl | ||
${RUN_PATH} syntax-bash | ||
${RUN_PATH} syntax-css | ||
${RUN_PATH} syntax-js | ||
${RUN_PATH} syntax-json | ||
${RUN_PATH} syntax-markdown | ||
${RUN_PATH} syntax-perl | ||
${RUN_PATH} syntax-php | ||
${RUN_PATH} syntax-python | ||
${RUN_PATH} syntax-ruby | ||
${RUN_PATH} syntax-scss | ||
${RUN_PATH} syntax-sh |
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,141 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
|
||
### | ||
### Define Paths | ||
### | ||
GIT_PATH="$( cd "$(dirname "$0")" ; pwd -P )/.." | ||
ETC_PATH="${GIT_PATH}/etc/awesome-ci.conf" | ||
BIN_PATH="${GIT_PATH}/bin" | ||
|
||
TEST_SUCC_PATH="${GIT_PATH}/test/ok" | ||
TEST_FAIL_PATH="${GIT_PATH}/test/err" | ||
|
||
# Add dependencies to path | ||
PATH=${GIT_PATH}/dependencies:${PATH} | ||
|
||
|
||
### | ||
### Check arguments | ||
### | ||
if [ "${#}" -ne "1" ]; then | ||
>&2 echo "This script requires exactly one argument: ${#} are given." | ||
exit 1 | ||
fi | ||
|
||
# Path to binary | ||
BINARY="${BIN_PATH}/${1}" | ||
|
||
|
||
############################################################ | ||
# Functions | ||
############################################################ | ||
|
||
run () { | ||
local cmd="${1}" | ||
|
||
>&2 echo "----------------------------------------------------------------------------------------------------" | ||
>&2 echo "\$ ${cmd}" | ||
>&2 echo "----------------------------------------------------------------------------------------------------" | ||
|
||
${cmd} | ||
} | ||
|
||
|
||
############################################################ | ||
# Run tests | ||
############################################################ | ||
|
||
|
||
### | ||
### 1. Info | ||
### | ||
COMMAND="${BINARY} --info" | ||
if ! OUT="$( run "${COMMAND}" )"; then | ||
echo "${OUT}" | ||
>&2 echo "[Error] 'Info test' failed" | ||
exit 1 | ||
fi | ||
echo "[TEST PASSED]" | ||
echo | ||
|
||
|
||
### | ||
### 2. Dry | ||
### | ||
if [ "${1}" = "git-ignored" ]; then | ||
COMMAND="${BINARY} --path=. --dry" | ||
else | ||
COMMAND="${BINARY} --path=. --config=${ETC_PATH} --dry" | ||
fi | ||
if ! OUT="$( run "${COMMAND}" )"; then | ||
echo "${OUT}" | ||
>&2 echo "[TEST FAILED] 'Dry test' failed" | ||
exit 1 | ||
fi | ||
echo "[TEST PASSED]" | ||
echo | ||
|
||
|
||
### | ||
### 3. Test OK | ||
### | ||
if [ "${1}" != "git-ignored" ] && [ "${1}" != "regex-grep" ] && [ "${1}" != "regex-perl" ]; then | ||
|
||
COMMAND="${BINARY} --path=${TEST_SUCC_PATH} --config=${ETC_PATH}" | ||
|
||
if ! OUT="$( run "${COMMAND} --list" )"; then | ||
echo "${OUT}" | ||
>&2 echo "[TEST FAILED] 'Success test' failed" | ||
exit 1 | ||
fi | ||
echo "[TEST PASSED]" | ||
echo | ||
|
||
if ! OUT="$( run "${COMMAND} --verbose" )"; then | ||
echo "${OUT}" | ||
>&2 echo "[TEST FAILED] 'Success test' failed" | ||
exit 1 | ||
fi | ||
echo "[TEST PASSED]" | ||
echo | ||
|
||
if ! OUT="$( run "${COMMAND}" )"; then | ||
echo "${OUT}" | ||
>&2 echo "[TEST FAILED] 'Success test' failed" | ||
exit 1 | ||
fi | ||
echo "[TEST PASSED]" | ||
echo | ||
fi | ||
|
||
|
||
### | ||
### 3. Test Failure | ||
### | ||
if [ "${1}" != "git-ignored" ] && [ "${1}" != "regex-grep" ] && [ "${1}" != "regex-perl" ]; then | ||
|
||
COMMAND="${BINARY} --path=${TEST_FAIL_PATH} --config=${ETC_PATH}" | ||
|
||
if ! OUT="$( run "${COMMAND} --verbose" )"; then | ||
echo "[TEST PASSED]" | ||
echo | ||
else | ||
echo "${OUT}" | ||
>&2 echo "[TEST FAILED] 'Failure test' failed" | ||
exit 1 | ||
fi | ||
|
||
if ! OUT="$( run "${COMMAND}" )"; then | ||
echo "[TEST PASSED]" | ||
echo | ||
else | ||
echo "${OUT}" | ||
>&2 echo "[TEST FAILED] 'Failure test' failed" | ||
exit 1 | ||
fi | ||
fi |