-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from primis/append
- Loading branch information
Showing
9 changed files
with
122 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Run this file to run all the tests, once | ||
./test/libs/bats/bin/bats test/*.bats | ||
./test/libs/bats/bin/bats test/*.bats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!./test/libs/bats/bin/bats | ||
|
||
load 'helpers' | ||
|
||
setup() { | ||
setupNotesEnv | ||
} | ||
|
||
teardown() { | ||
teardownNotesEnv | ||
} | ||
|
||
notes="./notes" | ||
|
||
@test "Appends a note with a message from commandline" { | ||
$notes append note.md Test | ||
run $notes cat note.md | ||
|
||
assert_success | ||
assert_output $'Test' | ||
} | ||
|
||
@test "Doesn't override a file, it actually appends" { | ||
$notes append note.md Test1 | ||
$notes append note.md Test2 | ||
run $notes cat note.md | ||
|
||
assert_success | ||
assert_output $'Test1\nTest2' | ||
} | ||
|
||
@test "Accepts input from stdin pipe" { | ||
echo "Echo Test" | $notes append note.md | ||
run $notes cat note.md | ||
|
||
assert_success | ||
assert_output $'Echo Test' | ||
} | ||
|
||
@test "Works with more than one word given via commandline" { | ||
$notes append note.md Multi word test | ||
run $notes cat note.md | ||
|
||
assert_success | ||
assert_output $'Multi word test' | ||
} | ||
|
||
@test "Fails when no message is given" { | ||
run $notes append note.md | ||
|
||
assert_failure | ||
assert_output $'No text was provided to append' | ||
} | ||
|
||
@test "Shortname works to invoke append" { | ||
$notes a note.md Test | ||
run $notes cat note.md | ||
|
||
assert_success | ||
assert_output $'Test' | ||
} | ||
|
||
@test "Should complain and ask for a name if one is not provided" { | ||
run $notes append | ||
|
||
assert_failure | ||
assert_line "Append requires a name, but none was provided." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters