diff --git a/tests/project-root1.sh b/tests/project-root1.sh index e0a4efe..1d80071 100755 --- a/tests/project-root1.sh +++ b/tests/project-root1.sh @@ -35,5 +35,31 @@ testProjectRoot002() { assertEquals "" "$pr" } +testResolveSymlink001() { + d1=$(mktemp -d --tmpdir targetdir.XXXXX) + expected="$d1/target" + touch "$expected" + + d2=$(mktemp -d --tmpdir linkdir.XXXXX) + link="$d2"/link + ln -s "$d1"/target "$link" + + resolved=$(resolve_symlink $link) + + assertEquals "$expected" "$resolved" +} + +# This test is ugly but there's no obvious way to make it +# better without making it entirely tautological. +testNoramlizeDirOfFile001() { + input="$DIR"/../install.sh + + expected="$DIR/.." + + out=$(normalize_dir_of_file "$input") + + assertEquals "$expected" "$out/tests/.." +} + # shellcheck disable=SC1091 source shunit2