Merge branch 'the1ts/master'
This commit is contained in:
@@ -8,7 +8,7 @@ test_description='Multi-line functionality'
|
|||||||
# Create the expected file
|
# Create the expected file
|
||||||
echo "1: smell the cheese
|
echo "1: smell the cheese
|
||||||
replaced with
|
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' '
|
test_expect_success 'multiline item replace' '
|
||||||
(
|
(
|
||||||
@@ -18,7 +18,8 @@ cat /dev/null > $HOME/todo.txt
|
|||||||
|
|
||||||
# Run replace
|
# Run replace
|
||||||
"$HOME/bin/todo.sh" replace 1 "eat apples
|
"$HOME/bin/todo.sh" replace 1 "eat apples
|
||||||
eat oranges" > $HOME/output.multi
|
eat oranges
|
||||||
|
drink milk" > $HOME/output.multi
|
||||||
|
|
||||||
# Test output against expected
|
# Test output against expected
|
||||||
diff "$HOME/output.multi" "$HOME/expect.multi"
|
diff "$HOME/output.multi" "$HOME/expect.multi"
|
||||||
@@ -32,7 +33,7 @@ fi
|
|||||||
|
|
||||||
## Add test
|
## Add test
|
||||||
# Create the expected file
|
# 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' '
|
test_expect_success 'multiline item add' '
|
||||||
(
|
(
|
||||||
@@ -42,7 +43,8 @@ cat /dev/null > $HOME/todo.txt
|
|||||||
|
|
||||||
# Run add
|
# Run add
|
||||||
"$HOME/bin/todo.sh" add "eat apples
|
"$HOME/bin/todo.sh" add "eat apples
|
||||||
eat oranges" > $HOME/output.multi
|
eat oranges
|
||||||
|
drink milk" > $HOME/output.multi
|
||||||
|
|
||||||
# Test output against expected
|
# Test output against expected
|
||||||
diff "$HOME/output.multi" "$HOME/expect.multi"
|
diff "$HOME/output.multi" "$HOME/expect.multi"
|
||||||
@@ -56,7 +58,7 @@ fi
|
|||||||
|
|
||||||
## Append test
|
## Append test
|
||||||
# Create the expected file
|
# 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' '
|
test_expect_success 'multiline item append' '
|
||||||
(
|
(
|
||||||
@@ -66,7 +68,8 @@ cat /dev/null > $HOME/todo.txt
|
|||||||
|
|
||||||
# Run append
|
# Run append
|
||||||
"$HOME/bin/todo.sh" append 1 "eat apples
|
"$HOME/bin/todo.sh" append 1 "eat apples
|
||||||
eat oranges" > $HOME/output.multi
|
eat oranges
|
||||||
|
drink milk" > $HOME/output.multi
|
||||||
|
|
||||||
# Test output against expected
|
# Test output against expected
|
||||||
diff "$HOME/output.multi" "$HOME/expect.multi"
|
diff "$HOME/output.multi" "$HOME/expect.multi"
|
||||||
@@ -80,7 +83,7 @@ fi
|
|||||||
|
|
||||||
## Prepend test
|
## Prepend test
|
||||||
# Create the expected file
|
# 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' '
|
test_expect_success 'multiline item prepend' '
|
||||||
(
|
(
|
||||||
@@ -90,7 +93,8 @@ cat /dev/null > $HOME/todo.txt
|
|||||||
|
|
||||||
# Run prepend
|
# Run prepend
|
||||||
"$HOME/bin/todo.sh" prepend 1 "eat apples
|
"$HOME/bin/todo.sh" prepend 1 "eat apples
|
||||||
eat oranges" > $HOME/output.multi
|
eat oranges
|
||||||
|
drink milk" > $HOME/output.multi
|
||||||
|
|
||||||
# Test output against expected
|
# Test output against expected
|
||||||
diff "$HOME/output.multi" "$HOME/expect.multi"
|
diff "$HOME/output.multi" "$HOME/expect.multi"
|
||||||
|
|||||||
7
todo.sh
7
todo.sh
@@ -17,9 +17,10 @@ EndVersion
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set script name early.
|
# Set script name and full path early.
|
||||||
TODO_SH=$(basename "$0")
|
TODO_SH=$(basename "$0")
|
||||||
export TODO_SH
|
TODO_FULL_SH="$0"
|
||||||
|
export TODO_SH TODO_FULL_SH
|
||||||
|
|
||||||
oneline_usage="$TODO_SH [-fhpantvV] [-d todo_config] action [task_number] [task_description]"
|
oneline_usage="$TODO_SH [-fhpantvV] [-d todo_config] action [task_number] [task_description]"
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ cleaninput()
|
|||||||
{
|
{
|
||||||
# Cleanup the input
|
# Cleanup the input
|
||||||
# Replace newlines with spaces
|
# Replace newlines with spaces
|
||||||
input=`echo $input | tr -d '\n'`
|
input=`echo $input | tr -d '\r|\n'`
|
||||||
}
|
}
|
||||||
|
|
||||||
archive()
|
archive()
|
||||||
|
|||||||
Reference in New Issue
Block a user