Commit graph

28 commits

Author SHA1 Message Date
David Laban
e1af1520e7 sort: make compare_by honour settings.reverse
This allows sort --merge --reverse to work as well.
2016-08-13 00:42:43 +01:00
David Laban
8a8319a337 sort --merge works, but ignores --unique and --reverse
FileMerger receives Lines Iterables of the pre-sorted input files
via push_file() It implements Iterator, which yields lines from the
input files in (merged) sorted order. If the input files are not sorted,
then the behavior is undefined.

Internally, FileMerger uses a
std::collections::BinaryHeap<MergeableFile>.

MergeableFile is an internal helper that implements Ord in a way that
BinaryHeap can use (note that we want smallest-first, but BinaryHeap
returns largest first, so MergeableFile::cmp() calls reverse() on
whatever compare_by() returns.
2016-08-13 00:42:43 +01:00
Nathan Ross
1880c46acd Merge pull request #946 from ChrisNikkel/feature/zero_terminated
uniq: add -z option to allow for zero terminated input and output
2016-08-06 22:49:10 -04:00
Chris Nikkel
c0b2da7c01 uniq: add test for zero terminated input and output 2016-08-06 18:41:39 -07:00
Nathan Ross
cb6f84e3d8 tests/cut: positive testcases for feature complete 2016-08-06 17:11:54 -04:00
David Laban
6751d2c708 implement sort --stable
Made a new function sort_by(lines, compare_fns), which accepts a
list of compare_fns and calls lines.sort_by() with a closure that
calls each compare_fn in turn until one returns something other
than equal.

Default behavior ensures that String::cmp is the last element in the
compare_fns list (referred to as 'last resort' sorting by man sort).
Passing --stable (-s) turns this behaviour off.

Test cases provided for `sort --month` and `sort --month --stable`.
2016-08-03 07:56:40 +01:00
Jeremy Neptune
b59016cbd7
cp: fixed failing tests due to git's weirdness with files
Made variable names in test_cp.rs more descriptive
2016-07-15 15:29:47 -04:00
Jeremy Neptune
97bb134fc9
cp: added fixtures required for testing 2016-07-15 13:23:12 -04:00
palaviv
3fd8136423 sort: Support check 2016-06-14 22:21:30 +03:00
palaviv
3bc5a5f769 sort: support multiple input files 2016-06-14 21:25:29 +03:00
palaviv
87455f998a sort: Version sort support 2016-06-14 20:33:09 +03:00
palaviv
d4ffbe0526 sort: unique option support 2016-06-11 15:46:41 +03:00
Mariano Casco
abb9501894 tail: test -f with no files 2016-05-31 17:40:06 -03:00
Mariano Casco
9c584bab9d tail: test following multiple files
The test_follow_multiple() test verifies that input is read upon append
on both files and that headers are printed when expected.
2016-05-30 17:34:53 -03:00
Knight
92e95c7263 dircolors: tests added 2016-05-11 00:43:51 +08:00
Valentin Lorentz
2fd7164cda tail: Implement tail -z.
This options makes tail use NULL instead of newline as a line
delimiter.
2016-04-02 12:32:33 +02:00
Joseph Crail
6b129887d6 tests/sort: add test for default mode 2016-03-29 00:58:24 -04:00
Joseph Crail
b290c10845 tests/sort: refactor to match other tests
Instead of using numerals to denote individual cases, I used descriptive
case names. I also changed the extension for the expected output fixture
to match other tests.

I removed one redundant test and another unnecessary helper function.
2016-03-29 00:58:24 -04:00
Nick Fitzgerald
9824bc4db3 Add a test for tail -c <BYTES> from stdin 2016-03-26 11:56:00 -07:00
Nick Fitzgerald
445233389e Add a test for tail -c <BYTES> <FILE> 2016-03-26 11:52:10 -07:00
Joseph Crail
55c0b1786f tests/sort: add tests for month sort 2016-03-25 16:55:58 -04:00
Nick Fitzgerald
161f96dc8c tests/tail: Rename tail test fixture contents to be easier to read
The repetition of "foo" and "bar" made for difficult-to-read assertion failures
when hacking on `tail`. I think that having each line have unique contents makes
it a bit easier to parse.
2016-03-21 07:51:42 -07:00
Chirag B. Jadwani
676e3718c3 uniq: add tests 2016-02-29 11:07:16 +05:30
Nathan Ross
d1e785c1dc comm: additional tests and status/stderr checking for existing tests 2016-02-22 09:59:06 -05:00
Leonid Shalupov
1b48438b44 .gitattributes: treat tests/fixtures/** as binary data to prevent CRLF convertion by git under Windows 2016-02-14 17:09:47 +01:00
Joseph Crail
cf399faad2 Add initial tests for default values 2015-12-12 16:24:48 -05:00
Michael Gehring
2f4ae615ed comm: add basic tests 2015-11-28 20:51:11 +01:00
Nathan Ross
a21c54e2cd rewrite tests for cargo compat, decoupled directory, output handling 2015-11-23 02:04:15 -05:00