An Express-like HTTP router for Bash compatible with CGI 1.1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
764 B

# shellcheck disable=SC2154,SC2034
testSessionDir='/tmp/exprash_test_sessions'
mkdir -p "$testSessionDir"
it "Should set session directory" "$({
_exprashInit
useSession "$testSessionDir"
[ "$_exprashSessionDir" == "$testSessionDir" ]
})"
it "Should save and load session" "$({
_exprashInit
useSession "$testSessionDir"
session 'data' 'value'
session_id=$_exprashSessionId
cookie_value=${_exprashSetCookies[$_exprashSessionCookieName]}
_exprashShutdown
# Forcibly clear session data just in case (but it should also get cleared by
# _exprashInit)
_exprashSession=()
_exprashSessionId=''
HTTP_COOKIE="${_exprashSessionCookieName}=$cookie_value"
_exprashInit
useSession "$testSessionDir"
[ "$(session 'data')" == "value" ]
})"