mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
tee: move test to "linux_only" module
This commit is contained in:
parent
86f0c617d8
commit
cccaba63c2
1 changed files with 20 additions and 23 deletions
|
@ -8,8 +8,6 @@ use uutests::util::TestScenario;
|
||||||
use uutests::{at_and_ucmd, new_ucmd, util_name};
|
use uutests::{at_and_ucmd, new_ucmd, util_name};
|
||||||
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
use std::fmt::Write;
|
|
||||||
use std::process::Stdio;
|
use std::process::Stdio;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
@ -94,27 +92,6 @@ fn test_tee_append() {
|
||||||
assert_eq!(at.read(file), content.repeat(2));
|
assert_eq!(at.read(file), content.repeat(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
fn test_tee_no_more_writeable_1() {
|
|
||||||
// equals to 'tee /dev/full out2 <multi_read' call
|
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
|
||||||
let content = (1..=10).fold(String::new(), |mut output, x| {
|
|
||||||
writeln!(output, "{x}").unwrap();
|
|
||||||
output
|
|
||||||
});
|
|
||||||
let file_out = "tee_file_out";
|
|
||||||
|
|
||||||
ucmd.arg("/dev/full")
|
|
||||||
.arg(file_out)
|
|
||||||
.pipe_in(&content[..])
|
|
||||||
.fails()
|
|
||||||
.stdout_contains(&content)
|
|
||||||
.stderr_contains("No space left on device");
|
|
||||||
|
|
||||||
assert_eq!(at.read(file_out), content);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_readonly() {
|
fn test_readonly() {
|
||||||
let (at, mut ucmd) = at_and_ucmd!();
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
@ -604,6 +581,26 @@ mod linux_only {
|
||||||
expect_correct(file_out_a, &at, content.as_str());
|
expect_correct(file_out_a, &at, content.as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tee_no_more_writeable_1() {
|
||||||
|
// equals to 'tee /dev/full out2 <multi_read' call
|
||||||
|
let (at, mut ucmd) = at_and_ucmd!();
|
||||||
|
let content = (1..=10).fold(String::new(), |mut output, x| {
|
||||||
|
writeln!(output, "{x}").unwrap();
|
||||||
|
output
|
||||||
|
});
|
||||||
|
let file_out = "tee_file_out";
|
||||||
|
|
||||||
|
ucmd.arg("/dev/full")
|
||||||
|
.arg(file_out)
|
||||||
|
.pipe_in(&content[..])
|
||||||
|
.fails()
|
||||||
|
.stdout_contains(&content)
|
||||||
|
.stderr_contains("No space left on device");
|
||||||
|
|
||||||
|
assert_eq!(at.read(file_out), content);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tee_no_more_writeable_2() {
|
fn test_tee_no_more_writeable_2() {
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue