realpath.t (3725B)
- #!/usr/bin/env cram
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- $ export path="$TESTDIR/../cmd"
- $ test "$($path/realpath .)" = "$(pwd)"
- $ $path/realpath /
- /
- $ $path/realpath /var
- /var
- $ $path/realpath /var/
- /var
- $ $path/realpath /var/empty
- /var/empty
- $ $path/realpath /var/empty/foo
- /var/empty/foo
- $ $path/realpath /var/empty/foo/
- /var/empty/foo
- $ $path/realpath /var/empty/foo//
- /var/empty/foo
- $ $path/realpath /var/empty/foo/bar
- realpath: Failed canonilizing parent of full path "/var/empty/foo/bar": No such file or directory
- [1]
- $ $path/realpath /var/empty/foo/bar/
- realpath: Failed canonilizing parent of full path "/var/empty/foo/bar": No such file or directory
- [1]
- $ $path/realpath /var/empty/foo/bar//
- realpath: Failed canonilizing parent of full path "/var/empty/foo/bar": No such file or directory
- [1]
- $ test "$($path/realpath .)" = "$(pwd)"
- $ $path/realpath /
- /
- $ $path/realpath /var
- /var
- $ $path/realpath /var/
- /var
- $ $path/realpath /var/empty
- /var/empty
- $ $path/realpath /var/empty/foo
- /var/empty/foo
- $ $path/realpath /var/empty/foo/
- /var/empty/foo
- $ $path/realpath /var/empty/foo//
- /var/empty/foo
- $ $path/realpath /var/empty/foo/bar
- realpath: Failed canonilizing parent of full path "/var/empty/foo/bar": No such file or directory
- [1]
- $ $path/realpath /var/empty/foo/bar/
- realpath: Failed canonilizing parent of full path "/var/empty/foo/bar": No such file or directory
- [1]
- $ $path/realpath /var/empty/foo/bar//
- realpath: Failed canonilizing parent of full path "/var/empty/foo/bar": No such file or directory
- [1]
- $ test "$($path/realpath -e .)" = "$(pwd)"
- $ $path/realpath -e /
- /
- $ $path/realpath -e /var
- /var
- $ $path/realpath -e /var/
- /var
- $ $path/realpath -e /var/empty
- /var/empty
- $ $path/realpath -e /var/empty/foo
- realpath: Failed canonilizing "/var/empty/foo": No such file or directory
- [1]
- $ $path/realpath -e /var/empty/foo/
- realpath: Failed canonilizing "/var/empty/foo/": No such file or directory
- [1]
- $ $path/realpath -e /var/empty/foo//
- realpath: Failed canonilizing "/var/empty/foo//": No such file or directory
- [1]
- $ $path/realpath -e /var/empty/foo/bar
- realpath: Failed canonilizing "/var/empty/foo/bar": No such file or directory
- [1]
- $ $path/realpath -e /var/empty/foo/bar/
- realpath: Failed canonilizing "/var/empty/foo/bar/": No such file or directory
- [1]
- $ $path/realpath -e /var/empty/foo/bar//
- realpath: Failed canonilizing "/var/empty/foo/bar//": No such file or directory
- [1]
- Non-directory
- $ $path/realpath /dev/null
- /dev/null
- $ $path/realpath -e /dev/null
- /dev/null
- $ $path/realpath -E /dev/null
- /dev/null
- $ $path/realpath /dev/null/
- realpath: Failed canonilizing "/dev/null/": Not a directory
- [1]
- $ $path/realpath -e /dev/null/
- realpath: Failed canonilizing "/dev/null/": Not a directory
- [1]
- $ $path/realpath -E /dev/null/
- realpath: Failed canonilizing "/dev/null/": Not a directory
- [1]
- $ $path/realpath /dev/null/..
- realpath: Failed canonilizing "/dev/null/..": Not a directory
- [1]
- $ $path/realpath -e /dev/null/..
- realpath: Failed canonilizing "/dev/null/..": Not a directory
- [1]
- $ $path/realpath -E /dev/null/..
- realpath: Failed canonilizing "/dev/null/..": Not a directory
- [1]
- Zero-separation
- $ $path/realpath -z /dev/null /var/empty
- /dev/null\x00/var/empty\x00 (no-eol) (esc)
- No final newline
- $ $path/realpath -n /dev/null /var/empty
- /dev/null
- /var/empty (no-eol)
- As required by "IEEE P1003.1™-202x/D4" -E and -e aren't errorneous
- $ $path/realpath -E -e /dev/null
- /dev/null