aboutsummaryrefslogtreecommitdiff
path: root/bin/cp/tests
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2024-04-08 22:41:33 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2024-04-08 22:41:33 +0000
commit0729d1e8fd90afc2f19e9b9834533181caf6ddee (patch)
treeb0a34d69db8886dfc9dbdfea8754be6e58880ee6 /bin/cp/tests
parentd80a97def9a1db6f07f5d2e68f7ad62b27918947 (diff)
Diffstat (limited to 'bin/cp/tests')
-rwxr-xr-xbin/cp/tests/cp_test.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh
index 397c06d75bbb..5c581e06ab8e 100755
--- a/bin/cp/tests/cp_test.sh
+++ b/bin/cp/tests/cp_test.sh
@@ -363,6 +363,35 @@ symlink_exists_force_body()
atf_check -o inline:"foo\n" readlink bar
}
+atf_test_case directory_to_symlink
+directory_to_symlink_body()
+{
+ mkdir -p foo
+ ln -s .. foo/bar
+ mkdir bar
+ touch bar/baz
+ atf_check -s not-exit:0 -e match:"Not a directory" \
+ cp -R bar foo
+ atf_check -s not-exit:0 -e match:"Not a directory" \
+ cp -r bar foo
+}
+
+atf_test_case overwrite_directory
+overwrite_directory_body()
+{
+ mkdir -p foo/bar/baz
+ touch bar
+ atf_check -s not-exit:0 -e match:"Is a directory" \
+ cp bar foo
+ rm bar
+ mkdir bar
+ touch bar/baz
+ atf_check -s not-exit:0 -e match:"Is a directory" \
+ cp -R bar foo
+ atf_check -s not-exit:0 -e match:"Is a directory" \
+ cp -r bar foo
+}
+
atf_init_test_cases()
{
atf_add_test_case basic
@@ -388,4 +417,6 @@ atf_init_test_cases()
atf_add_test_case symlink
atf_add_test_case symlink_exists
atf_add_test_case symlink_exists_force
+ atf_add_test_case directory_to_symlink
+ atf_add_test_case overwrite_directory
}