forked from bats-core/bats-core
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0515ce0
commit 3d7e49f
Showing
62 changed files
with
1,749 additions
and
616 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG bashver=latest | ||
|
||
FROM bash:${bashver} | ||
|
||
# Install parallel and accept the citation notice (we aren't using this in a | ||
# context where it make sense to cite GNU Parallel). | ||
RUN echo "@edgecomm http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \ | ||
apk update && \ | ||
apk add --no-cache parallel ncurses shellcheck@edgecomm && \ | ||
mkdir -p ~/.parallel && touch ~/.parallel/will-cite | ||
|
||
RUN ln -s /opt/bats/bin/bats /usr/sbin/bats | ||
COPY . /opt/bats/ | ||
|
||
ENTRYPOINT ["bash", "/usr/sbin/bats"] |
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,4 @@ | ||
{ | ||
"name": "Bats core development environment", | ||
"dockerFile": "Dockerfile" | ||
} |
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
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,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ -z "$TMPDIR" ]]; then | ||
BATS_TMPDIR='/tmp' | ||
else | ||
BATS_TMPDIR="${TMPDIR%/}" | ||
fi | ||
|
||
BATS_TMPNAME="$BATS_RUN_TMPDIR/bats.$$" | ||
BATS_PARENT_TMPNAME="$BATS_RUN_TMPDIR/bats.$PPID" | ||
# shellcheck disable=SC2034 | ||
BATS_OUT="${BATS_TMPNAME}.out" # used in bats-exec-file | ||
|
||
bats_preprocess_source() { | ||
BATS_TEST_SOURCE="${BATS_TMPNAME}.src" | ||
bats-preprocess "$BATS_TEST_FILENAME" >"$BATS_TEST_SOURCE" | ||
trap 'bats_cleanup_preprocessed_source' ERR EXIT | ||
trap 'bats_cleanup_preprocessed_source; exit 1' INT | ||
} | ||
|
||
bats_cleanup_preprocessed_source() { | ||
rm -f "$BATS_TEST_SOURCE" | ||
} | ||
|
||
bats_evaluate_preprocessed_source() { | ||
if [[ -z "$BATS_TEST_SOURCE" ]]; then | ||
BATS_TEST_SOURCE="${BATS_PARENT_TMPNAME}.src" | ||
fi | ||
# Dynamically loaded user files provided outside of Bats. | ||
# shellcheck disable=SC1090 | ||
source "$BATS_TEST_SOURCE" | ||
} |
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,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
BATS_TEST_DIRNAME="${BATS_TEST_FILENAME%/*}" | ||
BATS_TEST_NAMES=() | ||
|
||
load() { | ||
local name="$1" | ||
local filename | ||
|
||
if [[ "${name:0:1}" == '/' ]]; then | ||
filename="${name}" | ||
else | ||
filename="$BATS_TEST_DIRNAME/${name}.bash" | ||
fi | ||
|
||
if [[ ! -f "$filename" ]]; then | ||
printf 'bats: %s does not exist\n' "$filename" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Dynamically loaded user files provided outside of Bats. | ||
# shellcheck disable=SC1090 | ||
source "${filename}" | ||
} | ||
|
||
run() { | ||
local origFlags="$-" | ||
set +eET | ||
local origIFS="$IFS" | ||
# 'output', 'status', 'lines' are global variables available to tests. | ||
# shellcheck disable=SC2034 | ||
output="$("$@" 2>&1)" | ||
# shellcheck disable=SC2034 | ||
status="$?" | ||
# shellcheck disable=SC2034,SC2206 | ||
IFS=$'\n' lines=($output) | ||
IFS="$origIFS" | ||
set "-$origFlags" | ||
} | ||
|
||
setup() { | ||
return 0 | ||
} | ||
|
||
teardown() { | ||
return 0 | ||
} | ||
|
||
skip() { | ||
# Following variables are used in bats-exec-test which sources this file | ||
# shellcheck disable=SC2034 | ||
BATS_TEST_SKIPPED="${1:-1}" | ||
# shellcheck disable=SC2034 | ||
BATS_TEST_COMPLETED=1 | ||
exit 0 | ||
} | ||
|
||
bats_test_begin() { | ||
BATS_TEST_DESCRIPTION="$1" | ||
if [[ -n "$BATS_EXTENDED_SYNTAX" ]]; then | ||
printf 'begin %d %s\n' "$BATS_TEST_NUMBER" "$BATS_TEST_DESCRIPTION" >&3 | ||
fi | ||
setup | ||
} | ||
|
||
bats_test_function() { | ||
local test_name="$1" | ||
BATS_TEST_NAMES+=("$test_name") | ||
} |
Oops, something went wrong.