mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
53 lines
1.2 KiB
Bash
53 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
test_description='Test cookie path.'
|
|
|
|
. "$TEST_LIB"
|
|
|
|
test_is_path_prefix_expect_success () {
|
|
desc="$1"; shift
|
|
cookiepath="$1"; shift
|
|
requestpath="$1"; shift
|
|
|
|
test_expect_success "$desc" \
|
|
"cookies-t \"$cookiepath\" \"$requestpath\""
|
|
}
|
|
|
|
test_is_path_prefix_expect_failure () {
|
|
desc="$1"; shift
|
|
cookiepath="$1"; shift
|
|
requestpath="$1"; shift
|
|
|
|
test_expect_failure "$desc" \
|
|
"cookies-t \"$cookiepath\" \"$requestpath\""
|
|
}
|
|
|
|
|
|
test_is_path_prefix_expect_success \
|
|
'The cookie-path and the request-path are identical.' \
|
|
'/test' \
|
|
'/test'
|
|
|
|
test_is_path_prefix_expect_success \
|
|
'The cookie-path is a prefix of the request-path, and the last character of the cookie-path is ("/").' \
|
|
'/some/thing/' \
|
|
'/some/thing/more'
|
|
|
|
test_is_path_prefix_expect_success \
|
|
'The cookie-path is a prefix of the request-path, and the first character of the request-path that is not included in the cookie-path is a ("/") character.' \
|
|
'/some/thing' \
|
|
'/some/thing/stupid'
|
|
|
|
test_is_path_prefix_expect_failure \
|
|
'The cookie-path and the request-path are not identical.' \
|
|
'/test' \
|
|
'/testb'
|
|
|
|
test_is_path_prefix_expect_failure \
|
|
'The cookie-path is longer.' \
|
|
'/test/' \
|
|
'/test'
|
|
|
|
|
|
test_done
|