tests: new function remove_cr_inplace in init.cfg

When testing on Windows OSes, remove any CR (\r) characters
from output files (before comparing them to expected output).

This functionality was used by the old-style tests, embedded
directly in 'Makefile.tests'.

* init.cfg: (remove_cr_inplace): New function.
This commit is contained in:
Assaf Gordon committed 2017-05-10 21:37:28 -04:00
1 parent 9f521104fa
commit 96b8cec2aa
1 file changed
+10
+10
View File
@@ -110,3 +110,13 @@ require_valid_ja_eucjp_locale_()
local n=$(printf '\262C' | LC_ALL="$1" test-mbrtowc)
test "x$n" = "x-2,-1" || skip_ "locale '$1' is buggy"
}
# When testing on a Windows machine, sed might output
# line endings as CR,LF (\r\n) pairs - which will
# then fail comparison with the expected output files.
#
# This function removes the CR (\r) characters from the given input file.
remove_cr_inplace()
{
sed -i -e "s/\r//g" "$@" || framework_failure_
}