From 681e94f4d03f609ecaeaa8229fcfae31bb5311f0 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Fri, 2 Sep 2016 21:13:46 +0000 Subject: [PATCH] sh: Add some tests for non-standard features of the echo builtin. MFC after: 1 week --- bin/sh/tests/builtins/Makefile | 3 +++ bin/sh/tests/builtins/echo1.0 | 6 ++++++ bin/sh/tests/builtins/echo2.0 | 7 +++++++ bin/sh/tests/builtins/echo3.0 | 5 +++++ 4 files changed, 21 insertions(+) create mode 100644 bin/sh/tests/builtins/echo1.0 create mode 100644 bin/sh/tests/builtins/echo2.0 create mode 100644 bin/sh/tests/builtins/echo3.0 diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index bd23550324c2..b3e325507dd5 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -68,6 +68,9 @@ ${PACKAGE}FILES+= dot1.0 ${PACKAGE}FILES+= dot2.0 ${PACKAGE}FILES+= dot3.0 ${PACKAGE}FILES+= dot4.0 +${PACKAGE}FILES+= echo1.0 +${PACKAGE}FILES+= echo2.0 +${PACKAGE}FILES+= echo3.0 ${PACKAGE}FILES+= eval1.0 ${PACKAGE}FILES+= eval2.0 ${PACKAGE}FILES+= eval3.0 diff --git a/bin/sh/tests/builtins/echo1.0 b/bin/sh/tests/builtins/echo1.0 new file mode 100644 index 000000000000..75ed8fbbc45f --- /dev/null +++ b/bin/sh/tests/builtins/echo1.0 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +# Not specified by POSIX. + +[ "`echo -n a b; echo c d; echo e f`" = "a bc d +e f" ] diff --git a/bin/sh/tests/builtins/echo2.0 b/bin/sh/tests/builtins/echo2.0 new file mode 100644 index 000000000000..254b5c4dca4f --- /dev/null +++ b/bin/sh/tests/builtins/echo2.0 @@ -0,0 +1,7 @@ +# $FreeBSD$ + +# Not specified by POSIX. + +a=`echo -e '\a\b\e\f\n\r\t\v\\\\\0041\c'; echo .` +b=`printf '\a\b\033\f\n\r\t\v\\\\!.'` +[ "$a" = "$b" ] diff --git a/bin/sh/tests/builtins/echo3.0 b/bin/sh/tests/builtins/echo3.0 new file mode 100644 index 000000000000..ff8f6c2f26e4 --- /dev/null +++ b/bin/sh/tests/builtins/echo3.0 @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# Not specified by POSIX. + +[ "`echo -e 'a\cb' c; echo d`" = "ad" ]