File: test_false.rs

package info (click to toggle)
rust-coreutils 0.0.30-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,752 kB
  • sloc: sh: 1,088; python: 407; javascript: 72; makefile: 51
file content (57 lines) | stat: -rw-r--r-- 1,293 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// This file is part of the uutils coreutils package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use crate::common::util::TestScenario;
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
use std::fs::OpenOptions;

#[test]
fn test_exit_code() {
    new_ucmd!().fails();
}

#[test]
fn test_version() {
    new_ucmd!()
        .args(&["--version"])
        .fails()
        .stdout_contains("false");
}

#[test]
fn test_help() {
    new_ucmd!()
        .args(&["--help"])
        .fails()
        .stdout_contains("false");
}

#[test]
fn test_short_options() {
    for option in ["-h", "-V"] {
        new_ucmd!().arg(option).fails().stdout_is("");
    }
}

#[test]
fn test_conflict() {
    new_ucmd!()
        .args(&["--help", "--version"])
        .fails()
        .stdout_is("");
}

#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
fn test_full() {
    for option in ["--version", "--help"] {
        let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();

        new_ucmd!()
            .arg(option)
            .set_stdout(dev_full)
            .fails()
            .stderr_contains("No space left on device");
    }
}