From 76ab0ff50cd468831c4623671aef6f38c7ebdae5 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 13 May 2014 00:50:52 -0400 Subject: [PATCH] Expectation handler no longer receives extra newline --- src/spec | 2 +- test/test-spec | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/spec b/src/spec index 7449a9f..1946b6a 100644 --- a/src/spec +++ b/src/spec @@ -187,7 +187,7 @@ _handle-to() # shift argument allows the implementation to vary without breaking BC so # long as the meaning of the shifted arguments do not change $assert "$__spec_rexit" $__SHIFTN "$__spec_errpath" "$@" \ - <<< "$__spec_result" + < <( echo -n "$__spec_result" ) } diff --git a/test/test-spec b/test/test-spec index 8873f8f..b0bf626 100644 --- a/test/test-spec +++ b/test/test-spec @@ -193,6 +193,21 @@ describe expect end '; to succeed end + + # that is, if we use <<< to provide premise output from memory, a + # newline will be added; we don't want that! + it does not have newline added to premise output if missing + expect test-run <<< ' + _expect--chk() { test "$( wc -c )" -eq 0; } + + describe foo + it should not add newline + expect true + to chk + end + end + '; to succeed + end end