aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-02-04 17:43:27 -0800
committerRob Landley <rob@landley.net>2019-02-04 21:03:17 -0600
commitd5ad47d000635aa69f2016bf641958c89fba26cc (patch)
tree411e4c75299ba9baba7724fb2183f6f2a9cf8d4b /tests
parent02f220a9a6a8b358d18b26824ed3434cbdbbd75b (diff)
downloadtoybox-d5ad47d000635aa69f2016bf641958c89fba26cc.tar.gz
sort -o: fix behavior when output file is one of the input files.
Bug: http://b/123902291
Diffstat (limited to 'tests')
-rwxr-xr-xtests/sort.test2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/sort.test b/tests/sort.test
index c71012f0..a40d1b0f 100755
--- a/tests/sort.test
+++ b/tests/sort.test
@@ -13,6 +13,8 @@ testing "stdin" "sort" "a\nb\nc\n" "" "b\na\nc\n"
testing "numeric" "sort -n input" "1\n3\n010\n" "3\n1\n010\n" ""
testing "reverse" "sort -r input" "wook\nwalrus\npoint\npabst\naargh\n" \
"point\nwook\npabst\naargh\nwalrus\n" ""
+testing "sort -o" "sort input -o output && cat output" "a\nb\nc\n" "c\na\nb\n" ""
+testing "sort -o same" "sort input -o input && cat input" "a\nb\nc\n" "c\na\nb\n" ""
# Longish chunk of data re-used by the next few tests. The expected output
# varies, but the input (this) is the same.