Skip to content

Commit

Permalink
supported formatting codes
Browse files Browse the repository at this point in the history
  • Loading branch information
lehmannro committed Jun 2, 2014
1 parent 12b4608 commit c5f9b6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions assert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ assert() {
# assert <command> <expected stdout> [stdin]
(( tests_ran++ )) || :
[[ -z "$DISCOVERONLY" ]] || return
# printf required for formatting
printf -v expected "x${2:-}" # x required to overwrite older results
expected=$(echo -ne "${2:-}")
result="$(eval 2>/dev/null $1 <<< ${3:-})" || true
# Note: $expected is already decorated
if [[ "x$result" == "$expected" ]]; then
if [[ "$result" == "$expected" ]]; then
[[ -z "$DEBUG" ]] || echo -n .
return
fi
Expand Down
2 changes: 2 additions & 0 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,6 @@ _clean INVARIANT=;
assert date 20.N;
_date=22;
assert_end;" "all 1 tests passed in 2s."
# commit: supported formatting codes
assert "echo %s" "%s"
assert_end regression

0 comments on commit c5f9b6f

Please sign in to comment.