diff options
author | Rob Landley <rob@landley.net> | 2019-12-21 03:21:26 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-12-21 03:21:26 -0600 |
commit | de2ba955dac53cdf2c1810df83259a4155704d88 (patch) | |
tree | 7e4c947218f6b3f7e028cc3c721adbfb89adc650 | |
parent | c795f1b32487df79c43998aa13745ddf5d3eb44c (diff) | |
download | toybox-de2ba955dac53cdf2c1810df83259a4155704d88.tar.gz |
Very basic patch smoketest
-rwxr-xr-x | tests/patch.test | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/patch.test b/tests/patch.test new file mode 100755 index 00000000..788a1b01 --- /dev/null +++ b/tests/patch.test @@ -0,0 +1,81 @@ +#!/bin/bash + +[ -f testing.sh ] && . testing.sh + +#testing "name" "command" "result" "infile" "stdin" + +testing "create file" "patch >/dev/null && cat bork" "one\ntwo\nthree\n" "" " +--- /dev/null ++++ bork +@@ -0,0 +1,3 @@ ++one ++two ++three +" +testing "insert in middle" "patch > /dev/null && cat bork" \ + "one\nfour\ntwo\nthree\n" "" " +--- bork ++++ bork +@@ -1,3 +1,4 @@ + one ++four + two + three +" +testing "append at end" "patch > /dev/null && cat bork" \ + "one\nfour\ntwo\nthree\nfive\nsix\n" "" " +--- bork ++++ bork +@@ -2,3 +2,5 @@ + four + two + three ++five ++six +" +testing "insert at start" "patch > /dev/null && cat bork" \ + "seven\none\nfour\ntwo\nthree\nfive\nsix\n" "" " +--- bork ++++ bork +@@ -1,3 +1,4 @@ ++seven + one + four + two +" +testing "delete at end" "patch > /dev/null && cat bork" \ + "seven\none\nfour\ntwo\nthree\nfive\n" "" " +--- bork ++++ bork +@@ -4,4 +4,3 @@ + two + three + five +-six +" + +testing "delete at start" "patch > /dev/null && cat bork" \ + "four\ntwo\nthree\nfive\n" "" " +--- bork ++++ bork +@@ -1,5 +1,3 @@ +-seven +-one + four + two + three +" + +testing "filter timestamps" "patch > /dev/null && cat bork" \ + "four\ntwo\nthree\neight\nfive\n" "" " +--- bork 2019-12-20 16:54:35.735630973 -0600 ++++ bork 2019-12-20 16:57:03.083625706 -0600 +@@ -1,4 +1,5 @@ + four + two + three ++eight + five +" + +# todo bork bork2 |