link (869B)
- #!/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:usage: link <reference> <destination>\n" ../cmd/link
- }
- atf_test_case basic cleanup
- basic_body() {
- touch foo
- atf_check ../cmd/link foo bar
- atf_check cmp foo bar
- echo hello >> foo
- atf_check cmp foo bar
- }
- basic_cleanup() {
- atf_check rm -f foo bar
- }
- atf_test_case enoent
- enoent_body() {
- atf_check -s exit:1 -e 'inline:link: No such file or directory\n' ../cmd/link /var/empty/e/no/ent enoent_foo
- atf_check -s exit:1 -e 'inline:link: No such file or directory\n' ../cmd/link enoent_bar /var/empty/e/no/ent
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case empty
- atf_add_test_case basic
- atf_add_test_case enoent
- }