From: Niels Möller Date: Wed, 27 Aug 2008 08:54:21 +0000 (+0200) Subject: (print_raw, print_nl): Use printf. X-Git-Tag: nettle_2.0_release_20090608~84 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7da17612246437d1b1dc6f67639ecdc25f0eb3fd;p=thirdparty%2Fnettle.git (print_raw, print_nl): Use printf. Updated testcases with comments; comments are now preserved. Rev: nettle/testsuite/sexp-conv-test:1.2 --- diff --git a/testsuite/sexp-conv-test b/testsuite/sexp-conv-test index 7d7cc6bc..eed19e5a 100755 --- a/testsuite/sexp-conv-test +++ b/testsuite/sexp-conv-test @@ -4,28 +4,12 @@ if [ -z "$srcdir" ] ; then srcdir=`pwd` fi -# echo -n is not portable - -if [ "`echo -n ''`" = "" ]; then - n='-n'; c='' -elif [ "`echo '\c'`" = "" ]; then - n=''; c='\c' -else - echo >&2 'Neither echo -n nor echo \c seems to work.' - exit 1 -fi - -# Doesn't work if $1 contains print_raw () { - echo $n "$1$c" > "$2" + printf "%s" "$1" > "$2" } -# Using a here-document seems more robust. However, I don't know how -# to get rid of the final newline, so we can't use it exclusively. print_nl () { - cat >"$2" < "$2" } test_advanced () { @@ -106,7 +90,13 @@ test_advanced '()' '()' test_advanced '(foo bar baz)' '(foo bar baz)' test_advanced '; comment -()' '()' +()' '; comment + +()' +test_advanced '(foo ; gazonk +bar)' '(foo ; gazonk + + bar)' test_advanced '(foo[bar]foo)' '(foo [bar]foo)'