From f44bcfb06788b72b9c32561b446762b03579f462 Mon Sep 17 00:00:00 2001 From: Paul Mansfield Date: Fri, 4 Sep 2009 12:23:48 +0100 Subject: [PATCH] Bug Fix, better fix for "add does not escape line breaks" Now removes windows and unix style line breaks. Each test has a windows and a unix style line break. --- tests/t2000-multiline.sh | 20 ++++++++++++-------- todo.sh | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/t2000-multiline.sh b/tests/t2000-multiline.sh index b9fe7b2..40c7e15 100755 --- a/tests/t2000-multiline.sh +++ b/tests/t2000-multiline.sh @@ -8,7 +8,7 @@ test_description='Multi-line functionality' # Create the expected file echo "1: smell the cheese replaced with -1: eat apples eat oranges">$HOME/expect.multi +1: eat apples eat oranges drink milk">$HOME/expect.multi test_expect_success 'multiline item replace' ' ( @@ -18,7 +18,8 @@ cat /dev/null > $HOME/todo.txt # Run replace "$HOME/bin/todo.sh" replace 1 "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" @@ -32,7 +33,7 @@ fi ## Add test # Create the expected file -echo "TODO: 'eat apples eat oranges' added on line 2.">$HOME/expect.multi +echo "TODO: 'eat apples eat oranges drink milk' added on line 2.">$HOME/expect.multi test_expect_success 'multiline item add' ' ( @@ -42,7 +43,8 @@ cat /dev/null > $HOME/todo.txt # Run add "$HOME/bin/todo.sh" add "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" @@ -56,7 +58,7 @@ fi ## Append test # Create the expected file -echo "1: smell the cheese eat apples eat oranges">$HOME/expect.multi +echo "1: smell the cheese eat apples eat oranges drink milk">$HOME/expect.multi test_expect_success 'multiline item append' ' ( @@ -66,7 +68,8 @@ cat /dev/null > $HOME/todo.txt # Run append "$HOME/bin/todo.sh" append 1 "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" @@ -80,7 +83,7 @@ fi ## Prepend test # Create the expected file -echo "1: eat apples eat oranges smell the cheese">$HOME/expect.multi +echo "1: eat apples eat oranges drink milk smell the cheese">$HOME/expect.multi test_expect_success 'multiline item prepend' ' ( @@ -90,7 +93,8 @@ cat /dev/null > $HOME/todo.txt # Run prepend "$HOME/bin/todo.sh" prepend 1 "eat apples -eat oranges" > $HOME/output.multi +eat oranges +drink milk" > $HOME/output.multi # Test output against expected diff "$HOME/output.multi" "$HOME/expect.multi" diff --git a/todo.sh b/todo.sh index 4593286..4750bb1 100755 --- a/todo.sh +++ b/todo.sh @@ -244,7 +244,7 @@ cleaninput() { # Cleanup the input # Replace newlines with spaces - input=`echo $input | tr -d '\n'` + input=`echo $input | tr -d '\r|\n'` } archive()