diff options
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/realpath.tests | 45 | ||||
-rwxr-xr-x | testsuite/xxd.tests | 6 |
2 files changed, 51 insertions, 0 deletions
diff --git a/testsuite/realpath.tests b/testsuite/realpath.tests new file mode 100755 index 000000000..0e68e0279 --- /dev/null +++ b/testsuite/realpath.tests | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Realpath tests. | ||
4 | # Copyright 2006 by Natanael Copa <n@tanael.org> | ||
5 | # Copyright 2021 by Ron Yorston <rmy@pobox.com> | ||
6 | # Licensed under GPLv2, see file LICENSE in this source tree. | ||
7 | |||
8 | . ./testing.sh | ||
9 | |||
10 | unset LC_ALL | ||
11 | unset LC_MESSAGES | ||
12 | unset LANG | ||
13 | unset LANGUAGE | ||
14 | |||
15 | TESTDIR=realpath_testdir | ||
16 | TESTLINK1="link1" | ||
17 | TESTLINK2="link2" | ||
18 | |||
19 | # create the dir and test files | ||
20 | mkdir -p "./$TESTDIR" | ||
21 | ln -s "./$TESTDIR/not_file" "./$TESTLINK1" | ||
22 | ln -s "./$TESTDIR/not_file/not_dir" "./$TESTLINK2" | ||
23 | |||
24 | # shell's $PWD may leave symlinks unresolved. | ||
25 | # "pwd" may be a built-in and have the same problem. | ||
26 | # External pwd _can't_ have that problem (current dir on Unix is physical). | ||
27 | pwd=`which pwd` | ||
28 | pwd=`$pwd` | ||
29 | testing "realpath on non-existent absolute path 1" "realpath /not_file" "/not_file\n" "" "" | ||
30 | testing "realpath on non-existent absolute path 2" "realpath /not_file/" "/not_file\n" "" "" | ||
31 | testing "realpath on non-existent absolute path 3" "realpath //not_file" "/not_file\n" "" "" | ||
32 | testing "realpath on non-existent absolute path 4" "realpath /not_dir/not_file 2>&1" "realpath: /not_dir/not_file: No such file or directory\n" "" "" | ||
33 | |||
34 | testing "realpath on non-existent local file 1" "realpath $TESTDIR/not_file" "$pwd/$TESTDIR/not_file\n" "" "" | ||
35 | testing "realpath on non-existent local file 2" "realpath $TESTDIR/not_dir/not_file 2>&1" "realpath: $TESTDIR/not_dir/not_file: No such file or directory\n" "" "" | ||
36 | |||
37 | testing "realpath on link to non-existent file 1" "realpath $TESTLINK1" "$pwd/$TESTDIR/not_file\n" "" "" | ||
38 | testing "realpath on link to non-existent file 2" "realpath $TESTLINK2 2>&1" "realpath: $TESTLINK2: No such file or directory\n" "" "" | ||
39 | testing "realpath on link to non-existent file 3" "realpath ./$TESTLINK1" "$pwd/$TESTDIR/not_file\n" "" "" | ||
40 | testing "realpath on link to non-existent file 4" "realpath ./$TESTLINK2 2>&1" "realpath: ./$TESTLINK2: No such file or directory\n" "" "" | ||
41 | |||
42 | # clean up | ||
43 | rm -r "$TESTLINK1" "$TESTLINK2" "$TESTDIR" | ||
44 | |||
45 | exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255)) | ||
diff --git a/testsuite/xxd.tests b/testsuite/xxd.tests index 2e80be5fe..76fa96af9 100755 --- a/testsuite/xxd.tests +++ b/testsuite/xxd.tests | |||
@@ -31,4 +31,10 @@ testing 'xxd -p with 31 NULs' \ | |||
31 | '' \ | 31 | '' \ |
32 | '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' | 32 | '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' |
33 | 33 | ||
34 | testing 'xxd -p -r' \ | ||
35 | 'xxd -p -r' \ | ||
36 | '01234567765432100123456776543210' \ | ||
37 | '' \ | ||
38 | '30313233343536373736353433323130 30313233343536373736353433323130' | ||
39 | |||
34 | exit $FAILCOUNT | 40 | exit $FAILCOUNT |