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.
|
|
|
# shellcheck disable=SC2154,SC2034
|
|
|
|
|
|
|
|
test_session_dir='/tmp/exprash_test_sessions'
|
|
|
|
mkdir -p "$test_session_dir"
|
|
|
|
|
|
|
|
it "Should set session directory" "$({
|
|
|
|
_exprash_init
|
|
|
|
use_session "$test_session_dir"
|
|
|
|
[ "$_exprash_session_dir" == "$test_session_dir" ]
|
|
|
|
})"
|
|
|
|
|
|
|
|
it "Should save and load session" "$({
|
|
|
|
_exprash_init
|
|
|
|
use_session "$test_session_dir"
|
|
|
|
session 'data' 'value'
|
|
|
|
session_id=$_exprash_session_id
|
|
|
|
cookie_value=${_exprash_set_cookies[$_exprash_session_cookie_name]}
|
|
|
|
_exprash_shutdown
|
|
|
|
|
|
|
|
# Forcibly clear session data just in case (but it should also get cleared by
|
|
|
|
# _exprash_init)
|
|
|
|
_exprash_session=()
|
|
|
|
_exprash_session_id=''
|
|
|
|
|
|
|
|
HTTP_COOKIE="${_exprash_session_cookie_name}=$cookie_value"
|
|
|
|
_exprash_init
|
|
|
|
use_session "$test_session_dir"
|
|
|
|
[ "$(session 'data')" == "value" ]
|
|
|
|
})"
|
|
|
|
|