Merge branch 'the1ts/master'

This commit is contained in:
Gina Trapani
2009-09-08 11:57:20 -07:00
5 changed files with 79 additions and 1 deletions

View File

@@ -55,4 +55,18 @@ TODO: 'smell the uppercase Roses' added on line 3.
TODO: 2 of 3 tasks shown from $HOME/todo.txt
EOF
test_todo_session 'add with &' <<EOF
>>> todo.sh add "dig the garden & water the flowers"
TODO: 'dig the garden & water the flowers' added on line 4.
>>> todo.sh list
4 dig the garden & water the flowers
1 notice the daisies
2 smell the roses
3 smell the uppercase Roses
--
TODO: 4 of 4 tasks shown from $HOME/todo.txt
EOF
test_done

View File

@@ -72,6 +72,12 @@ TODO: 4 prioritized (A).
replaced with
4: (A) collect the bread
EOF
test_todo_session 'replace with &' << EOF
>>> todo.sh replace 3 "thrash the hay & thresh the wheat"
3: jump on hay
replaced with
3: thrash the hay & thresh the wheat
EOF
test_todo_session 'replace error' << EOF
>>> todo.sh replace 10 "hej!"

View File

@@ -52,4 +52,9 @@ TODO: 3 of 3 tasks shown from $HOME/todo.txt
EOF
test_todo_session 'prepend with &' <<EOF
>>> todo.sh prepend 3 "no running & jumping now"
3: no running & jumping now stop
EOF
test_done

47
tests/t1600-append.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/sh
test_description='basic append functionality
Ensure we can append items successfully.
'
. ./test-lib.sh
#
# Set up the basic todo.txt
#
todo.sh add notice the daisies > /dev/null
test_todo_session 'append usage' <<EOF
>>> todo.sh append adf asdfa
=== 1
usage: todo.sh append ITEM# "TEXT TO APPEND"
EOF
test_todo_session 'basic append' <<EOF
>>> todo.sh append 1 "smell the roses"
1: notice the daisies smell the roses
>>> todo.sh list
1 notice the daisies smell the roses
--
TODO: 1 of 1 tasks shown from $HOME/todo.txt
EOF
test_todo_session 'basic append with &' <<EOF
>>> todo.sh append 1 "see the wasps & bees"
1: notice the daisies smell the roses see the wasps & bees
>>> todo.sh list
1 notice the daisies smell the roses see the wasps & bees
--
TODO: 1 of 1 tasks shown from $HOME/todo.txt
EOF
test_todo_session 'append error' << EOF
>>> todo.sh append 10 "hej!"
=== 1
10: No such todo.
EOF
test_done

View File

@@ -246,8 +246,14 @@ cleanup()
cleaninput()
{
# Cleanup the input
# Replace newlines with spaces
# Replace newlines with spaces Always
input=`echo $input | tr -d '\r|\n'`
# Check which action we are being used in as this affects what cleaning we do
if [[ $action =~ ^(append|app|prepend|prep|replace)$ ]]; then
# These actions use sed and & as the matched string so escape it
input=`echo $input | sed 's/\&/\\\&/g'`
fi
}
archive()