Making tests care about whitespace

When testing #19 I found that the tests were mistakenly ignoring some
whitespace changes. I've enabled whitespace checks and had to update the
tests because my editor likes newlines at the end of files and removes
whitespace at the end of lines. To make the test files easier to manage,
I've modified some scenarios to still test for the feature but also work
with the whitespace modifications that editors would perform.
This commit is contained in:
Tyler Akins 2017-08-02 10:35:35 -05:00
parent f14150c205
commit 0627cbbaf8
No known key found for this signature in database
GPG Key ID: 8F3B8C432F4393BD
7 changed files with 14 additions and 12 deletions

View File

@ -21,7 +21,7 @@ for TEST in tests/*.expected; do
. "${BASE}.env" . "${BASE}.env"
echo "Do not read this input" | mo "${BASE}.template" echo "Do not read this input" | mo "${BASE}.template"
fi fi
) | diff -wU5 - "${TEST}" > "${BASE}.diff" ) | diff -U5 - "${TEST}" > "${BASE}.diff"
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo "FAIL" echo "FAIL"

View File

@ -1,4 +1,5 @@
name=Willy name=Willy
wrapped() { wrapped() {
echo "<b>$1</b>"; # The final newline is eaten by mo
echo "<b>$1</b>"
} }

View File

@ -1,2 +1,2 @@
<b> Willy is awesome. <b> Willy is awesome.
</b> </b>... this is the last line.

View File

@ -1,3 +1,4 @@
{{#wrapped}} {{#wrapped}}
{{name}} is awesome. {{name}} is awesome.
{{/wrapped}} {{/wrapped}}
... this is the last line.

View File

@ -1,4 +1,4 @@
* Chris * .Chris.
* * ..
* <b>GitHub</b> * .<b>GitHub</b>.
* <b>GitHub</b> * .<b>GitHub</b>.

View File

@ -1,4 +1,4 @@
* {{name}} * .{{name}}.
* {{age}} * .{{age}}.
* {{company}} * .{{company}}.
* {{{company}}} * .{{{company}}}.

View File

@ -1 +1 @@
multilineData=$'line 1\nline2' multilineData=$'line 1\nline 2'