[asterisk-commits] tilghman: branch 1.8 r327793 - /branches/1.8/tests/test_substitution.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 12 10:35:49 CDT 2011
Author: tilghman
Date: Tue Jul 12 10:35:46 2011
New Revision: 327793
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=327793
Log:
Use 'printf' (POSIX issue 4) instead of 'echo -n', for portability.
The problem with using 'echo -n' is that it is not portable. While BSD systems
required that the '-n' option be removed and interpreted, System V required
that all strings should be echoed with no interpretation of options. This
fundamental difference of behavior means that it is never possible to use the
'-n' flag to echo in tests which are meant to be portable.
In this case, on Mac OS X 10.6, the /bin/sh shell builtin 'echo' uses the
System V semantics of the command, and thus the SHELL test failed on that
platform.
http://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html#tag_04_41_16
Modified:
branches/1.8/tests/test_substitution.c
Modified: branches/1.8/tests/test_substitution.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/tests/test_substitution.c?view=diff&rev=327793&r1=327792&r2=327793
==============================================================================
--- branches/1.8/tests/test_substitution.c (original)
+++ branches/1.8/tests/test_substitution.c Tue Jul 12 10:35:46 2011
@@ -261,8 +261,8 @@
TEST(test_expected_result(test, c, "A${${baz}o:-2:-1}A", "A2A"));
pbx_builtin_setvar_helper(c, "list1", "ab&cd&ef");
TEST(test_expected_result(test, c, "${LISTFILTER(list1,&,cd)}", "ab&ef"));
- TEST(test_expected_result(test, c, "${SHELL(echo -n 123)},${SHELL(echo -n 456)}", "123,456"));
- TEST(test_expected_result(test, c, "${foo},${CDR(answer)},${SHELL(echo -n 456)}", "123,,456"));
+ TEST(test_expected_result(test, c, "${SHELL(printf '%d' 123)},${SHELL(printf '%d' 456)}", "123,456"));
+ TEST(test_expected_result(test, c, "${foo},${CDR(answer)},${SHELL(printf '%d' 456)}", "123,,456"));
TEST(test_expected_result(test, c, "${foo},${this_does_not_exist},${THIS_DOES_NOT_EXIST(either)}", "123,,"));
#undef TEST
More information about the asterisk-commits
mailing list