1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size

* truncate: use "parse_size" from uucore
* workaround fix for "test_reference"
This commit is contained in:
Jan Scheer 2021-05-31 19:11:06 +02:00
commit 8bf1e33b5d
128 changed files with 2052 additions and 1529 deletions

View file

@ -1,8 +1,8 @@
use crate::common::util::*;
use std::io::{Seek, SeekFrom, Write};
static TFILE1: &'static str = "truncate_test_1";
static TFILE2: &'static str = "truncate_test_2";
static TFILE1: &str = "truncate_test_1";
static TFILE2: &str = "truncate_test_2";
#[test]
fn test_increase_file_size() {
@ -45,14 +45,17 @@ fn test_reference() {
let at = &scene.fixtures;
let mut file = at.make_file(TFILE2);
scene.ucmd().arg("-s").arg("+5KB").arg(TFILE1).run();
// TODO: 'truncate' should create the file in this case because '--no-create' wasn't used
// A FILE argument that does not exist is created.
at.touch(TFILE1);
scene.ucmd().arg("-s").arg("+5KB").arg(TFILE1).succeeds();
scene
.ucmd()
.arg("--reference")
.arg(TFILE1)
.arg(TFILE2)
.run();
.succeeds();
file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap();
@ -262,3 +265,11 @@ fn test_reference_file_not_found() {
.fails()
.stderr_contains("cannot stat 'a': No such file or directory");
}
#[test]
fn test_reference_with_size_file_not_found() {
new_ucmd!()
.args(&["-r", "a", "-s", "+1", "b"])
.fails()
.stderr_contains("cannot stat 'a': No such file or directory");
}