Skip to content

Commit b479889

Browse files
committed
refactor(test): refine test
1 parent 9096b3d commit b479889

14 files changed

+7
-12
lines changed

test/case/015.mkdir.bash

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ source "$root"/lib.bash
1010
sleep 0.05 # wait server ready
1111
cleanup
1212

13-
file="$fs"/uploaded/1/foo.tmp
14-
ls -d "$file1" &> /dev/null && fail "$file1 exists"
13+
file1="$fs"/uploaded/1/foo.tmp
1514
curl_head_status 'http://127.0.0.1:3003/1/?mkdir&name=foo.tmp' > /dev/null
16-
ls -d "$file1"/ &> /dev/null || fail "$file1 not exists"
15+
[ -d "$file1" ] || fail "$file1 should exists as directory"
1716

1817
cleanup
1918
jobs -p | xargs kill

test/case/016.alias.mkdir.bash

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ sleep 0.05 # wait server ready
1111
cleanup
1212

1313
file1="$fs"/uploaded/1/foo.tmp
14-
ls -d "$file1" &> /dev/null && fail "$file1 exists"
1514
curl_head_status 'http://127.0.0.1:3003/free/space?mkdir&name=foo.tmp' > /dev/null
16-
ls -d "$file1"/ &> /dev/null || fail "$file1 not exists"
15+
[ -d "$file1" ] || fail "$file1 should exists as directory"
1716

1817
file2="$fs"/uploaded/2/bar.tmp
19-
ls -d "$file2" &> /dev/null && fail "$file2 exists"
2018
curl_head_status 'http://127.0.0.1:3003/share/dir/?mkdir&name=bar.tmp' > /dev/null
21-
ls -d "$file2"/ &> /dev/null || fail "$file2 not exists"
19+
[ -d "$file2" ] || fail "$file2 should exists as directory"
2220

2321
cleanup
2422
jobs -p | xargs kill

test/case/017.alias.shadowed.mkdir.bash

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ sleep 0.05 # wait server ready
1111
cleanup
1212

1313
file1="$fs"/uploaded/1/x.tmp
14-
ls "$file1" &> /dev/null && fail "$file1 exists"
1514
curl_head_status 'http://127.0.0.1:3003/?mkdir&name=x.tmp' > /dev/null
16-
ls "$file1" &> /dev/null && fail "$file1 exists"
15+
[ -e "$file1" ] && fail "$file1 should not exists"
1716

1817
file2="$fs"/uploaded/1/y.tmp
19-
ls "$file2" &> /dev/null && fail "$file2 exists"
20-
curl_head_status 'http://127.0.0.1:3003/?mkdir&name=x.tmp' > /dev/null
21-
ls "$file2" &> /dev/null && fail "$file2 exists"
18+
curl_head_status 'http://127.0.0.1:3003/?mkdir&name=y.tmp' > /dev/null
19+
[ -e "$file2" ] && fail "$file2 should not exists"
2220

2321
cleanup
2422
jobs -p | xargs kill
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)