Merge pull request #964 from knight42/uniq-add-tests

Uniq: add tests
This commit is contained in:
mpkh 2016-08-12 18:46:59 +00:00 committed by GitHub
commit 1c05100cd5
5 changed files with 122 additions and 32 deletions

123
README.md
View file

@ -147,29 +147,106 @@ To contribute to coreutils, please see [CONTRIBUTING](CONTRIBUTING.md).
To do To do
----- -----
- chcon * [x] arch
- runcon * [x] base32
- ~~md5sum~~, ~~sha1sum~~, ~~sha224sum~~, ~~sha256sum~~, ~~sha384sum~~, ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs)) * [x] base64
- chgrp * [x] basename
- cp (not much done) * [x] cat
- csplit * [ ] chcon
- date * [ ] chgrp
- dd * [x] chmod
- df * [x] chown
- expr (almost done, no regular expressions) * [x] chroot
- join * [x] cksum
- ls * [x] comm
- mv (almost done, one more option) * [ ] cp (not much done)
- numfmt * [ ] csplit
- od (in progress, needs lots of work) * [x] cut
- pr * [ ] date
- printf * [ ] dd
- sort (a couple of options implemented) * [ ] df
- split (a couple of missing options) * [x] dircolors
- stty * [x] dirname
- tail (not all features implemented) * [x] du
- test (not all features implemented) * [x] echo
- uniq (a couple of missing options) * [x] env
* [x] expand
* [ ] expr (almost done, no regular expressions)
* [x] factor
* [x] false
* [x] fmt
* [x] fold
* [x] groups
* [x] hashsum
* [x] head
* [x] hostid
* [x] hostname
* [x] id
* [ ] install (a couple of missing options)
* [ ] join
* [x] kill
* [x] link
* [x] ln
* [x] logname
* [ ] ls
* [x] ~~md5sum~~, ~~sha1sum~~, ~~sha224sum~~, ~~sha256sum~~, ~~sha384sum~~, ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs))
* [x] mkdir
* [x] mkfifo
* [x] mknod
* [x] mktemp
* [ ] mv (almost done, one more option)
* [x] nice
* [x] nl
* [x] nohup
* [x] nproc
* [ ] numfmt
* [ ] od (in progress, needs lots of work)
* [x] paste
* [x] pathchk
* [x] pinky
* [ ] pr
* [x] printenv
* [ ] printf
* [x] ptx
* [x] pwd
* [x] readlink
* [x] realpath
* [x] relpath
* [x] rm
* [x] rmdir
* [ ] runcon
* [x] seq
* [x] shred
* [x] shuf
* [x] sleep
* [ ] sort (a couple of options implemented)
* [ ] split (a couple of missing options)
* [x] stat
* [x] stdbuf
* [ ] stty
* [x] sum
* [x] sync
* [x] tac
* [ ] tail (not all features implemented)
* [x] tee
* [ ] test (not all features implemented)
* [x] timeout
* [x] touch
* [x] tr
* [x] true
* [x] truncate
* [x] tsort
* [x] tty
* [x] uname
* [x] unexpand
* [x] uniq
* [x] unlink
* [x] uptime
* [x] users
* [x] wc
* [x] who
* [x] whoami
* [x] yes
License License
------- -------

View file

@ -9,8 +9,10 @@ path = "uniq.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "*"
libc = "*"
uucore = { path="../uucore" } [dependencies.uucore]
path="../uucore"
default-features = false
[[bin]] [[bin]]
name = "uniq" name = "uniq"

View file

@ -4,22 +4,25 @@ version = "0.0.1"
authors = [] authors = []
[dependencies] [dependencies]
libc = { git = "https://github.com/rust-lang/libc.git" }
getopts = "*" getopts = "*"
time = { version = "*", optional = true } time = { version = "*", optional = true }
data-encoding = { version = "^1.1", optional = true } data-encoding = { version = "^1.1", optional = true }
[dependencies.libc]
git = "https://github.com/rust-lang/libc.git"
optional = true
[features] [features]
fs = [] fs = ["libc"]
utf8 = [] utf8 = []
encoding = ["data-encoding"] encoding = ["data-encoding"]
parse_time = [] parse_time = []
utmpx = ["time"] utmpx = ["time", "libc"]
c_types = [] c_types = ["libc"]
process = [] process = ["libc"]
signals = [] signals = []
wide = [] wide = []
default = ["fs", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "signals", "wide"] default = ["fs", "libc", "utf8", "encoding", "parse_time", "utmpx", "c_types", "process", "signals", "wide"]
[lib] [lib]
path = "lib.rs" path = "lib.rs"

View file

@ -1,3 +1,4 @@
#[cfg(feature = "libc")]
pub extern crate libc; pub extern crate libc;
#[macro_use] #[macro_use]

View file

@ -94,9 +94,16 @@ fn test_stdin_repeated_only() {
.run().stdout_is_fixture("sorted-repeated-only.expected"); .run().stdout_is_fixture("sorted-repeated-only.expected");
} }
#[test]
fn test_stdin_ignore_case() {
new_ucmd()
.args(&["-i"]).pipe_in_fixture(INPUT)
.run().stdout_is_fixture("sorted-ignore-case.expected");
}
#[test] #[test]
fn test_stdin_zero_terminated() { fn test_stdin_zero_terminated() {
new_ucmd() new_ucmd()
.args(&["-z"]).pipe_in_fixture(SORTED_ZERO_TERMINATED) .args(&["-z"]).pipe_in_fixture(SORTED_ZERO_TERMINATED)
.run().stdout_is_fixture("sorted-zero-terminated.expected"); .run().stdout_is_fixture("sorted-zero-terminated.expected");
} }