Last active
December 27, 2015 12:39
-
-
Save jmervine/7327793 to your computer and use it in GitHub Desktop.
Addtional shunt (http://github.com/odb/shunt) assertions.
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
# Extra assertions for shunt (github.com/odb/shunt) | |
# assert_stderr "cmd" "msg" | |
function assert_stderr { | |
local cmd=$1 | |
local msg="[assert_stderr] $3" | |
err="$( { $cmd; } 2>&1 >/dev/null )" | |
[ "$err" = "$str" ] | |
process "$?" "$msg" "" "contains stderr '$err'" | |
} | |
# refute_stderr "cmd" "msg" | |
function refute_stderr { | |
local cmd=$1 | |
local str=$2 | |
local msg="[refute_stderr] $3" | |
err="$( { $cmd; } 2>&1 >/dev/null )" | |
[ "$err" = "" ] | |
process "$?" "$msg" "" "no stderr" | |
} | |
function assert_link { | |
local file=$1 | |
local msg="[assert_link] $2" | |
_="$( { test -L $file; } 2>&1 )" | |
process "$?" "$msg" "" "link '$file' does not exist" | |
} | |
function refute_link { | |
local file=$1 | |
local msg="[refute_link] $2" | |
_="$( { test -L $file; } 2>&1 )" | |
[ "$?" -ne "0" ] | |
process "$?" "$msg" "" "link '$file' exists" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment