~sircmpwn/ctools

48c580e7b62d4d91ca9dcdb80c86cf5bd64c7a9f — Drew DeVault 2 years ago c8f8eb2
unlink: add conformance test
2 files changed, 15 insertions(+), 0 deletions(-)

M test/meson.build
A test/unlink
M test/meson.build => test/meson.build +1 -0
@@ 14,6 14,7 @@ test_files = [
	'true',
	'tty',
	'uname',
	'unlink',
]

foreach test_file : test_files

A test/unlink => test/unlink +14 -0
@@ 0,0 1,14 @@
#!/bin/sh
. "$HARNESS" link

should_remove_link() {
	touch "$TMPDIR"/file
	ln -s "$TMPDIR"/file "$TMPDIR"/symlink
	unlink "$TMPDIR"/symlink
	[ -e "$TMPDIR"/file ] && ! [ -e "$TMPDIR"/symlink ] || return 1
	unlink -- "$TMPDIR"/file
	! [ -e "$TMPDIR"/file ]
}

runtests \
	should_remove_link