mkdir (1324B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- atf_test_case empty
- empty_body() {
- atf_check -s exit:1 -e 'inline:mkdir: missing operands\nUsage: mkdir [-p] [-m mode] [directories...]\n' ../cmd/mkdir
- }
- atf_test_case foo cleanup
- foo_body() {
- atf_check rm -fr mkdir-foo
- atf_check ../cmd/mkdir mkdir-foo
- atf_check test -d mkdir-foo
- }
- foo_cleanup() {
- rm -fr mkdir-foo
- }
- atf_test_case p_flag cleanup
- p_flag_body() {
- atf_check rm -fr mkdir-p_flag/1/2/3
- atf_check -s exit:1 -e 'inline:mkdir: No such file or directory\n' ../cmd/mkdir mkdir-p_flag/1/2/3
- atf_check ../cmd/mkdir -p mkdir-p_flag/1/2/3
- atf_check test -d mkdir-p_flag/1/2/3
- }
- p_flag_cleanup() {
- rm -fr mkdir-p_flag/1/2/3
- }
- atf_test_case devnull
- devnull_body() {
- atf_check -s exit:1 -e 'inline:mkdir: File exists\n' ../cmd/mkdir /dev/null
- atf_check -s exit:1 -e 'inline:mkdir: File exists\n' ../cmd/mkdir -p /dev/null
- atf_check -s exit:1 -e 'inline:mkdir: Not a directory\n' ../cmd/mkdir /dev/null/no
- atf_check -s exit:1 -e 'inline:mkdir: Not a directory\n' ../cmd/mkdir -p /dev/null/no
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case empty
- atf_add_test_case foo
- #atf_add_test_case p_flag
- atf_add_test_case devnull
- }