Skip to content

Commit 8e5b43c

Browse files
committed
test: add case for non tailing slash url
1 parent 04a7263 commit 8e5b43c

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

test/case/001.basic.bash

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ sleep 0.05 # wait server ready
88
file1=$(curl_get_body http://127.0.0.1:3003/file1.txt)
99
assert "$file1" 'vhost1/file1.txt'
1010

11+
(curl_get_body http://127.0.0.1:3003/hello | grep -q './hello/index.txt') ||
12+
fail "resource /hello does not contains './hello/index.txt'"
13+
14+
(curl_get_body http://127.0.0.1:3003/hello/ | grep -q './index.txt') ||
15+
fail "resource /hello/ does not contains './index.txt'"
16+
1117
kill %1

test/fs/vhost1/file1-1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vhost1/file1-1.txt

test/fs/vhost1/file10.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vhost1/file10.txt

test/fs/vhost1/file2.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
vhost1/file1.txt
1+
vhost1/file2.txt

test/lib.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ assert() {
44
expect="$2"
55
actual="$1"
66
if [ "$expect" != "$actual" ]; then
7-
echo -e "$(basename $0): expect \"\e[0;32m$expect\e[0m\", got \"\e[1;31m$actual\e[0m\"" >&2
7+
echo -e "$(basename $0):${BASH_LINENO[0]} expect \"\e[0;32m$expect\e[0m\", got \"\e[1;31m$actual\e[0m\"" >&2
88
fi
99
}
1010

1111
fail() {
1212
msg="$1"
13-
echo -e "$(basename $0): \e[1;31m$msg\e[0m" >&2
13+
echo -e "$(basename $0):${BASH_LINENO[0]} \e[1;31m$msg\e[0m" >&2
1414
}
1515

1616
curl_head_status() {

0 commit comments

Comments
 (0)