Commit graph

623 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
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
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
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
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
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
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
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
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
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
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
Nick Fitzgerald
d7974c56a0 tests/tail: Add a test for tail'ing large files
This tests both large files and iterating backwards through the file when we
need to search backwards further than our BUFFER_SIZE.
2016-03-21 07:51:48 -07: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
Luca Ottaviano
5dc0a55630 chmod: fix reference option
Reference option must have a file path.
Fix C interface using CString.
Better error message if the file doesn't exist.
2016-03-10 20:34:49 +01: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
Heather
267a7d043a Merge pull request #821 from ebfe/cat-test
tests/cat: --squeeze-blank test
2016-02-22 09:24:32 +04:00
Nathan Ross
5e764ecf6e more ergonomic testing 2016-02-18 13:24:36 -05:00
Michael Gehring
c0d91d225f tests/cat: --squeeze-blank test 2016-02-17 08:06:32 +01:00
Nathan Ross
e44f29a020 basename: tests for bad inputs 2016-02-16 16:47:09 -05:00
Nathan Ross
8190c30a85 basename: tests for remaining options 2016-02-16 16:47:09 -05:00
Nathan Ross
21cee1556b basename: in tests, assert error-free in usage 2016-02-16 16:47:09 -05:00
Nathan Ross
962fcd7183 base64: tests for incorrect wrap args 2016-02-16 16:47:09 -05:00
Nathan Ross
2bad30b2b0 base64: in tests, test both option forms 2016-02-16 02:20:09 -05:00
Nathan Ross
e32efaa5a1 allow feature-gated integration tests for unimplemented functionality 2016-02-15 23:48:37 -05:00
Nathan Ross
5f88dfe12b printf: rustfmt pass 2016-02-15 00:48:08 -05:00
Nathan Ross
0892ad3cde printf: add (spare C99 hex floats) 2016-02-15 00:10:30 -05:00
Michael Gehring
1760f2937b Merge pull request #814 from shalupov/mark-fixtures-data-as-binary
.gitattributes: treat tests/fixtures/** as binary data
2016-02-14 19:21:18 +01: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
Leonid Shalupov
1ae82193f0 tests: do not remove %SYSTEMROOT% from environment variables, it's required to initialize crypto provider (which is required for std::rand) 2016-02-14 16:34:39 +01:00
Michael Gehring
162e21a418 tests/mktemp: fix build on nightly 2016-02-14 03:31:10 +01:00
Michael Gehring
033dd3a0ae tests/chmod: fix tests on nightly 2016-01-23 05:06:02 +01:00
Arcterus
49d0815588 tests: fix tests that broke when using a symlinked /tmp 2016-01-10 02:50:39 -08:00
Arcterus
d9ad0b185a tests: fix tests that were failing on OS X 2016-01-10 00:09:05 -08:00
Arcterus
ee669ab55b chmod: rewrite mode parser 2016-01-04 20:00:34 -08:00
Michael Gehring
1a78be7e37 tests/mktemp: remove unused import 2016-01-04 18:43:03 +01:00
Michael Gehring
73cd23ca71 Merge pull request #781 from KeenS/mktemp
Mktemp
2016-01-04 18:40:08 +01:00
Michael Gehring
2bc3001a3a tests/chmod: disable failing tests
See #788
2016-01-04 17:58:15 +01:00
Michael Gehring
83de52f66b tests: add some basic chmod tests 2016-01-04 17:28:27 +01:00
Sunrin SHIMURA (keen)
881e0892d2 [mktemp] use new API env 2016-01-04 02:11:15 +09:00
Sunrin SHIMURA (keen)
0d4e67929b Merge remote-tracking branch 'origin/master' into mktemp 2016-01-04 01:58:38 +09:00
Michael Gehring
830ca8c04d tests: add UCommand::env() 2016-01-03 14:24:15 +01:00
Sunrin SHIMURA (keen)
58d1d66d16 [mktemp] implement mktemp 2016-01-03 19:10:47 +09:00
Michael Gehring
b8ee9424c8 tests/touch: fix tests
Fixes #782
2016-01-02 09:55:20 +01:00
Nathan Ross
83295f1e08 appveyor and windows testing tooling updates 2015-12-23 22:59:04 -05:00
Heather
9339bbe50d Merge pull request #762 from ebfe/expr-and-or
expr: implement '|' and '&'
2015-12-22 17:20:58 +04:00
Heather
88710fa01d Merge pull request #760 from ebfe/disable-stdbuf
tests/stdbuf: disable on non-linux os
2015-12-22 17:20:24 +04:00
Michael Gehring
d4e0ee0cde expr: add basic tests 2015-12-22 14:10:43 +01:00
Michael Gehring
1fc698a17f tests/stdbuf: disable on non-linux os 2015-12-22 12:55:51 +01:00
Michael Gehring
ec1ec84f0c tests/env: don't assume vars are ordered 2015-12-22 12:44:05 +01:00
Michael Gehring
cb4f6a2978 dirname: add some tests 2015-12-21 11:17:37 +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
Michael Gehring
9365e100d9 Merge pull request #723 from jbcrail/cleanup
Fix whitespace, unused file, and warnings.
2015-11-25 10:20:46 +01:00
Joseph Crail
80f83ce15d Remove unused file. 2015-11-25 04:05:12 -05:00
Michael Gehring
e7398b3ca7 sum: fix sysv_stdin testcase 2015-11-25 09:58:58 +01:00
Joseph Crail
ca1074201f Split utility files into separate library.
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.

Fixes #717.
2015-11-24 22:20:27 -05:00
Nathan Ross
a21c54e2cd rewrite tests for cargo compat, decoupled directory, output handling 2015-11-23 02:04:15 -05:00