Commit graph

2040 commits

Author SHA1 Message Date
Valentin Lorentz
4ba6ea7aad tests: Move part of UCommand::run to a new function 2016-04-03 11:46:33 +02:00
Valentin Lorentz
fe5bc47971 tests: Simplify logic of UCommand::run. 2016-04-03 11:46:33 +02:00
Heather
b3b8a1ea54 Merge pull request #862 from fitzgen/tail-size-multiplier-suffix
tail: Clean up and test suffix multiplier
2016-04-03 01:59:24 +04:00
Nick Fitzgerald
3972c6eb53 tail: Clean up and test suffix multiplier
Makes `parse_size` return a `Result` where the `Err` part indicates whether
there was a parsing error, or the parse size is too big to store. Also makes the
value parsed a `u64` rather than a `usize`.

Adds unit tests for `parse_size` and integration tests using the suffix
multiplier in a number passed with the `-n` flag.
2016-04-02 14:16:11 -07:00
Heather
ed6c87b3d3 Merge pull request #858 from ProgVal/implement-tail-z
tail: Implement `tail -z`.
2016-04-02 15:07:37 +04: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
Luca Ottaviano
f0186271ec tests/chmod: add test with both reference and symbolic mode
Only reference should be taken into account.
2016-04-02 10:30:19 +02:00
Luca Ottaviano
bbe54bc0a8 tests/chmod: add missing test for many symbolic permissions at once 2016-04-02 10:29:57 +02:00
Luca Ottaviano
6ded76714b chmod: remove unused dependencies 2016-04-02 10:29:57 +02:00
Luca Ottaviano
2686ea75d7 chmod: handle -octal and -[rwx]
The main issue is that -octal or -[rwx] is interpreted as an option by
getopts.
Search the args for such a pattern, remove it before parsing and
manually handle it afterwards.
Fixes #788.
2016-04-02 10:29:57 +02:00
Luca Ottaviano
9005ae7dbf tests/chmod: refactor tests to only create reference file once 2016-04-02 10:29:35 +02:00
Heather
9e5a2400be Merge pull request #856 from jbcrail/refactor-sort-tests
Refactor sort tests
2016-03-29 09:31:51 +04:00
Joseph Crail
fb0e6a9dee tests/sort: simplify input to helper 2016-03-29 00:58:24 -04: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
Heather
977d352c05 Merge pull request #855 from jbcrail/fix-readlink-realpath-tests
Fix readlink/realpath tests on Windows
2016-03-29 08:40:04 +04:00
Joseph Crail
91df9b14da tests: remove unused method 2016-03-28 23:25:50 -04:00
Joseph Crail
7d103a0a64 tests: fix whitespace 2016-03-28 23:25:26 -04:00
Joseph Crail
1fecba3226 tests/{readlink, realpath}: fix tests on Windows
I fixed the tests that assumed paths used a Unix directory separator.
2016-03-28 23:24:40 -04:00
Heather
c954b01aa3 Merge pull request #854 from fitzgen/tests-for-tail-bytes
Miscellaneous `tail` related commits
2016-03-28 09:05:48 +04:00
Heather
b17adf1320 Merge pull request #853 from jbcrail/fix-pwd-test
tests/pwd: fix broken Windows test
2016-03-28 08:59:46 +04:00
Nick Fitzgerald
0d281cf886 tests/tail: Test when -n is larger than the number of lines in the file 2016-03-27 14:42:45 -07:00
Nick Fitzgerald
9a5209a7a4 tests/tail: Rename INPUT to FOOBAR_TXT as there are more than one inputs 2016-03-27 14:41:56 -07:00
Nick Fitzgerald
0bc05e2dcf tests/tail: Add a test for tail'ing large files in bytes mode 2016-03-27 14:34:59 -07:00
Nick Fitzgerald
1be7d31d5a tests/tail: Refactor the test_single_big_args test to use ScopedFile 2016-03-27 14:34:59 -07:00
Nick Fitzgerald
a629bb3076 tests: Create the ScopedFile type for temporary files in tests
This commit adds the `ScopedFile` type, which wraps and derefs to a `File`. When
a `ScopedFile` is dropped, it removes the underlying file from the
filesystem. This is useful for temporary, generated files in tests.
2016-03-27 14:34:59 -07:00
Nick Fitzgerald
2b2c2b64c2 tail: When tailing a file in bytes mode, seek directly to the specified byte
When tailing a file, as opposed to stdin, and we are tailing bytes rather than
lines, we can seek the requested number of bytes from the end of the file. This
side steps the whole `backwards_thru_file` file loop and blocks of reads.

Fixes #833.
2016-03-27 14:34:58 -07:00
Nick Fitzgerald
f851611001 tail: Pre-fill the buffer with zeroes
Rather than fill the buffer on every file read iteration, pre-fill it with
zeroes once at initialization time.
2016-03-27 14:34:58 -07:00
Heather
183224db15 Merge pull request #852 from jbcrail/contributing-commit-msgs
CONTRIBUTING: add guidelines for commit msgs
2016-03-27 19:50:56 +04:00
Joseph Crail
ec14be84aa tests/pwd: fix broken Windows test
Due to canonicalize()'s use of GetFinalPathNameByHandleW() on Windows,
the resolved path starts with '\\?\' to extend the limit of a given path
to 32,767 wide characters.

To address this issue, we remove this prepended string if available.
2016-03-27 03:28:55 -04:00
Joseph Crail
e0c21b99c5 Merge pull request #851 from fitzgen/tests-for-tail-bytes
Tests for `tail -c <bytes>`
2016-03-26 18:38:41 -04:00
Joseph Crail
7990fa11bf CONTRIBUTING: add guidelines for commit msgs 2016-03-26 18:31:01 -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
Michael Gehring
1922267076 Merge pull request #844 from jbcrail/sort_add_month
sort: refactor and add month sort
2016-03-26 07:26:13 +01:00
Jeremiah Peschka
e7458b6086 Fixing trailing semicolon in display_permissions 2016-03-25 18:43:43 -07:00
Jeremiah Peschka
539da3ba1a Changed display_symlink_count to use the right variable name. Removed dead code. 2016-03-25 16:36:34 -07:00
Jeremiah Peschka
6e562faae1 tabs not spaces 2016-03-25 15:30:25 -07:00
Jeremiah Peschka
0bb0c40c36 Adding tests for ls. Corrected issue with ls on the present directory throwing panic!() 2016-03-25 14:25:52 -07:00
Jeremiah Peschka
825a850fa9 Wishing I could spell my own name. 2016-03-25 14:18:23 -07:00
Jeremiah Peschka
9716862cfe Adding skeleton of ls 2016-03-25 14:00:27 -07:00
Joseph Crail
491320747b sort: remove explicit enum values 2016-03-25 16:55:58 -04:00
Joseph Crail
faedb2dd2e tests/sort: fix flag for human numeric test 2016-03-25 16:55:58 -04:00
Joseph Crail
55c0b1786f tests/sort: add tests for month sort 2016-03-25 16:55:58 -04:00
Joseph Crail
2cdccb10bb sort: fix whitespace and spelling 2016-03-25 16:55:58 -04:00
Joseph Crail
cc63565051 sort: add month sort 2016-03-25 16:55:58 -04:00
Joseph Crail
678a3d1451 sort: fix flag for human numeric sort 2016-03-25 16:55:50 -04:00
Joseph Crail
6488f168fb sort: refactor settings into dedicated struct 2016-03-25 16:51:39 -04:00
Heather
9c477a9ca8 Merge pull request #843 from llogiq/clippy
fix two clippy warnings
2016-03-24 15:38:45 +04:00
Andre Bogus
986c00cd91 fix two clippy warnings 2016-03-24 12:15:01 +01:00