tepl_utils_replace_home_dir_with_tilde fails if $HOME ends with a slash
Found in the build environment for the Exherbo linux distro, where the package is built with
HOME=/var/tmp/paludis/build/gnome-desktop-tepl-5.0.1/temp/
The test_replace_home_dir_with_tilde
fails with:
tepl:ERROR:../tepl-5.0.1/testsuite/test-utils.c:155:test_replace_home_dir_with_tilde: assertion failed (after == "~/blah"): ("/var/tmp/paludis/build/gnome-desktop-tepl-5.0.1/temp/blah" == "~/blah")
It looks like the tepl_utils_replace_home_dir_with_tilde
function adds a / to the end of the home directory unconditionally - even if a slash is already present. (So the string used in the prefix match has two slashes.) And since the file path built by g_build_filename
in the test collapses the slashes to a single slash, the prefix match fails.