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
-----
- chcon
- runcon
- ~~md5sum~~, ~~sha1sum~~, ~~sha224sum~~, ~~sha256sum~~, ~~sha384sum~~, ~~sha512sum~~ (replaced by [hashsum](https://github.com/uutils/coreutils/blob/master/src/hashsum/hashsum.rs))
- chgrp
- cp (not much done)
- csplit
- date
- dd
- df
- expr (almost done, no regular expressions)
- join
- ls
- mv (almost done, one more option)
- numfmt
- od (in progress, needs lots of work)
- pr
- printf
- sort (a couple of options implemented)
- split (a couple of missing options)
- stty
- tail (not all features implemented)
- test (not all features implemented)
- uniq (a couple of missing options)
* [x] arch
* [x] base32
* [x] base64
* [x] basename
* [x] cat
* [ ] chcon
* [ ] chgrp
* [x] chmod
* [x] chown
* [x] chroot
* [x] cksum
* [x] comm
* [ ] cp (not much done)
* [ ] csplit
* [x] cut
* [ ] date
* [ ] dd
* [ ] df
* [x] dircolors
* [x] dirname
* [x] du
* [x] echo
* [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
-------

View file

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

View file

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

View file

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

View file

@ -94,9 +94,16 @@ fn test_stdin_repeated_only() {
.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]
fn test_stdin_zero_terminated() {
new_ucmd()
.args(&["-z"]).pipe_in_fixture(SORTED_ZERO_TERMINATED)
.run().stdout_is_fixture("sorted-zero-terminated.expected");
}
}