mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
refactor ~ cargo make format
This commit is contained in:
parent
c392cd1cb4
commit
3f35e0a421
36 changed files with 129 additions and 100 deletions
|
@ -153,7 +153,10 @@ fn test_format_item_hex() {
|
||||||
assert_eq!(" 00000000", format_item_hex32(0));
|
assert_eq!(" 00000000", format_item_hex32(0));
|
||||||
assert_eq!(" ffffffff", format_item_hex32(0xffff_ffff));
|
assert_eq!(" ffffffff", format_item_hex32(0xffff_ffff));
|
||||||
assert_eq!(" 0000000000000000", format_item_hex64(0));
|
assert_eq!(" 0000000000000000", format_item_hex64(0));
|
||||||
assert_eq!(" ffffffffffffffff", format_item_hex64(0xffff_ffff_ffff_ffff));
|
assert_eq!(
|
||||||
|
" ffffffffffffffff",
|
||||||
|
format_item_hex64(0xffff_ffff_ffff_ffff)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
//! Primitives used by num_format and sub_modules.
|
//! Primitives used by num_format and sub_modules.
|
||||||
//! never dealt with above (e.g. Sub Tokenizer never uses these)
|
//! never dealt with above (e.g. Sub Tokenizer never uses these)
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,13 @@ impl Formatter for CninetyNineHexFloatf {
|
||||||
str_in: &str,
|
str_in: &str,
|
||||||
) -> Option<FormatPrimitive> {
|
) -> Option<FormatPrimitive> {
|
||||||
let second_field = field.second_field.unwrap_or(6) + 1;
|
let second_field = field.second_field.unwrap_or(6) + 1;
|
||||||
let analysis =
|
let analysis = FloatAnalysis::analyze(
|
||||||
FloatAnalysis::analyze(&str_in, initial_prefix, Some(second_field as usize), None, true);
|
&str_in,
|
||||||
|
initial_prefix,
|
||||||
|
Some(second_field as usize),
|
||||||
|
None,
|
||||||
|
true,
|
||||||
|
);
|
||||||
let f = get_primitive_hex(
|
let f = get_primitive_hex(
|
||||||
initial_prefix,
|
initial_prefix,
|
||||||
&str_in[initial_prefix.offset..],
|
&str_in[initial_prefix.offset..],
|
||||||
|
@ -51,7 +56,11 @@ fn get_primitive_hex(
|
||||||
_last_dec_place: usize,
|
_last_dec_place: usize,
|
||||||
capitalized: bool,
|
capitalized: bool,
|
||||||
) -> FormatPrimitive {
|
) -> FormatPrimitive {
|
||||||
let prefix = Some(String::from(if initial_prefix.sign == -1 { "-0x" } else { "0x" }));
|
let prefix = Some(String::from(if initial_prefix.sign == -1 {
|
||||||
|
"-0x"
|
||||||
|
} else {
|
||||||
|
"0x"
|
||||||
|
}));
|
||||||
|
|
||||||
// TODO actual conversion, make sure to get back mantissa.
|
// TODO actual conversion, make sure to get back mantissa.
|
||||||
// for hex to hex, it's really just a matter of moving the
|
// for hex to hex, it's really just a matter of moving the
|
||||||
|
|
|
@ -76,11 +76,13 @@ impl Formatter for Decf {
|
||||||
second_field as usize,
|
second_field as usize,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
Some(if get_len_fmt_primitive(&f_fl) >= get_len_fmt_primitive(&f_sci) {
|
Some(
|
||||||
f_sci
|
if get_len_fmt_primitive(&f_fl) >= get_len_fmt_primitive(&f_sci) {
|
||||||
} else {
|
f_sci
|
||||||
f_fl
|
} else {
|
||||||
})
|
f_fl
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
|
fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
|
||||||
primitive_to_str_common(prim, &field)
|
primitive_to_str_common(prim, &field)
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
// spell-checker:ignore (ToDO) arrnum
|
// spell-checker:ignore (ToDO) arrnum
|
||||||
|
|
||||||
use super::super::format_field::FormatField;
|
use super::super::format_field::FormatField;
|
||||||
use super::super::formatter::{get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix};
|
use super::super::formatter::{
|
||||||
|
get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InitialPrefix,
|
||||||
|
};
|
||||||
use super::base_conv;
|
use super::base_conv;
|
||||||
use super::base_conv::RadixDef;
|
use super::base_conv::RadixDef;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,13 @@ impl Formatter for Floatf {
|
||||||
str_in: &str,
|
str_in: &str,
|
||||||
) -> Option<FormatPrimitive> {
|
) -> Option<FormatPrimitive> {
|
||||||
let second_field = field.second_field.unwrap_or(6) + 1;
|
let second_field = field.second_field.unwrap_or(6) + 1;
|
||||||
let analysis =
|
let analysis = FloatAnalysis::analyze(
|
||||||
FloatAnalysis::analyze(&str_in, initial_prefix, None, Some(second_field as usize), false);
|
&str_in,
|
||||||
|
initial_prefix,
|
||||||
|
None,
|
||||||
|
Some(second_field as usize),
|
||||||
|
false,
|
||||||
|
);
|
||||||
let f = get_primitive_dec(
|
let f = get_primitive_dec(
|
||||||
initial_prefix,
|
initial_prefix,
|
||||||
&str_in[initial_prefix.offset..],
|
&str_in[initial_prefix.offset..],
|
||||||
|
|
|
@ -150,7 +150,12 @@ impl Intf {
|
||||||
// - if the string falls outside bounds:
|
// - if the string falls outside bounds:
|
||||||
// for i64 output, the int minimum or int max (depending on sign)
|
// for i64 output, the int minimum or int max (depending on sign)
|
||||||
// for u64 output, the u64 max in the output radix
|
// for u64 output, the u64 max in the output radix
|
||||||
fn conv_from_segment(segment: &str, radix_in: Base, field_char: char, sign: i8) -> FormatPrimitive {
|
fn conv_from_segment(
|
||||||
|
segment: &str,
|
||||||
|
radix_in: Base,
|
||||||
|
field_char: char,
|
||||||
|
sign: i8,
|
||||||
|
) -> FormatPrimitive {
|
||||||
match field_char {
|
match field_char {
|
||||||
'i' | 'd' => match i64::from_str_radix(segment, radix_in as u32) {
|
'i' | 'd' => match i64::from_str_radix(segment, radix_in as u32) {
|
||||||
Ok(i) => {
|
Ok(i) => {
|
||||||
|
|
|
@ -475,12 +475,14 @@ impl Stater {
|
||||||
let show_fs = matches.is_present(options::FILE_SYSTEM);
|
let show_fs = matches.is_present(options::FILE_SYSTEM);
|
||||||
|
|
||||||
let default_tokens = if format_str.is_empty() {
|
let default_tokens = if format_str.is_empty() {
|
||||||
Stater::generate_tokens(&Stater::default_format(show_fs, terse, false), use_printf).unwrap()
|
Stater::generate_tokens(&Stater::default_format(show_fs, terse, false), use_printf)
|
||||||
|
.unwrap()
|
||||||
} else {
|
} else {
|
||||||
Stater::generate_tokens(&format_str, use_printf)?
|
Stater::generate_tokens(&format_str, use_printf)?
|
||||||
};
|
};
|
||||||
let default_dev_tokens =
|
let default_dev_tokens =
|
||||||
Stater::generate_tokens(&Stater::default_format(show_fs, terse, true), use_printf).unwrap();
|
Stater::generate_tokens(&Stater::default_format(show_fs, terse, true), use_printf)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let mount_list = if show_fs {
|
let mount_list = if show_fs {
|
||||||
// mount points aren't displayed when showing filesystem information
|
// mount points aren't displayed when showing filesystem information
|
||||||
|
@ -540,12 +542,13 @@ impl Stater {
|
||||||
match result {
|
match result {
|
||||||
Ok(meta) => {
|
Ok(meta) => {
|
||||||
let file_type = meta.file_type();
|
let file_type = meta.file_type();
|
||||||
let tokens =
|
let tokens = if self.from_user
|
||||||
if self.from_user || !(file_type.is_char_device() || file_type.is_block_device()) {
|
|| !(file_type.is_char_device() || file_type.is_block_device())
|
||||||
&self.default_tokens
|
{
|
||||||
} else {
|
&self.default_tokens
|
||||||
&self.default_dev_tokens
|
} else {
|
||||||
};
|
&self.default_dev_tokens
|
||||||
|
};
|
||||||
|
|
||||||
for t in tokens.iter() {
|
for t in tokens.iter() {
|
||||||
match *t {
|
match *t {
|
||||||
|
@ -867,7 +870,8 @@ impl Stater {
|
||||||
} else {
|
} else {
|
||||||
format_str.push_str(" File: %N\n Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n");
|
format_str.push_str(" File: %N\n Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n");
|
||||||
if show_dev_type {
|
if show_dev_type {
|
||||||
format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %-5h Device type: %t,%T\n");
|
format_str
|
||||||
|
.push_str("Device: %Dh/%dd\tInode: %-10i Links: %-5h Device type: %t,%T\n");
|
||||||
} else {
|
} else {
|
||||||
format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %h\n");
|
format_str.push_str("Device: %Dh/%dd\tInode: %-10i Links: %h\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -612,12 +612,12 @@ impl FsMeta for StatFs {
|
||||||
}
|
}
|
||||||
#[cfg(target_os = "freebsd")]
|
#[cfg(target_os = "freebsd")]
|
||||||
fn namelen(&self) -> u64 {
|
fn namelen(&self) -> u64 {
|
||||||
self.f_namemax as u64 // spell-checker:disable-line
|
self.f_namemax as u64 // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
// XXX: should everything just use statvfs?
|
// XXX: should everything just use statvfs?
|
||||||
#[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))]
|
#[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))]
|
||||||
fn namelen(&self) -> u64 {
|
fn namelen(&self) -> u64 {
|
||||||
self.f_namemax as u64 // spell-checker:disable-line
|
self.f_namemax as u64 // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ fn table(c: &mut Criterion) {
|
||||||
// Deterministic RNG; use an explicitly-named RNG to guarantee stability
|
// Deterministic RNG; use an explicitly-named RNG to guarantee stability
|
||||||
use rand::{RngCore, SeedableRng};
|
use rand::{RngCore, SeedableRng};
|
||||||
use rand_chacha::ChaCha8Rng;
|
use rand_chacha::ChaCha8Rng;
|
||||||
const SEED: u64 = 0xdead_bebe_ea75_cafe; // spell-checker:disable-line
|
const SEED: u64 = 0xdead_bebe_ea75_cafe; // spell-checker:disable-line
|
||||||
let mut rng = ChaCha8Rng::seed_from_u64(SEED);
|
let mut rng = ChaCha8Rng::seed_from_u64(SEED);
|
||||||
|
|
||||||
std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64()))
|
std::iter::repeat_with(move || array_init::<_, _, INPUT_SIZE>(|_| rng.next_u64()))
|
||||||
|
|
|
@ -38,7 +38,7 @@ fn test_decode() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_garbage() {
|
fn test_garbage() {
|
||||||
let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
|
let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-d")
|
.arg("-d")
|
||||||
.pipe_in(input)
|
.pipe_in(input)
|
||||||
|
@ -49,7 +49,7 @@ fn test_garbage() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ignore_garbage() {
|
fn test_ignore_garbage() {
|
||||||
for ignore_garbage_param in &["-i", "--ignore-garbage"] {
|
for ignore_garbage_param in &["-i", "--ignore-garbage"] {
|
||||||
let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
|
let input = "aGVsbG8sIHdvcmxkIQ==\0"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-d")
|
.arg("-d")
|
||||||
.arg(ignore_garbage_param)
|
.arg(ignore_garbage_param)
|
||||||
|
|
|
@ -9,7 +9,7 @@ fn test_output_simple() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["alpha.txt"])
|
.args(&["alpha.txt"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line
|
.stdout_only("abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -67,8 +67,8 @@ fn test_fifo_symlink() {
|
||||||
assert!(s.fixtures.is_fifo("dir/pipe"));
|
assert!(s.fixtures.is_fifo("dir/pipe"));
|
||||||
|
|
||||||
// Make cat read the pipe through a symlink
|
// Make cat read the pipe through a symlink
|
||||||
s.fixtures.symlink_file("dir/pipe", "sympipe"); // spell-checker:disable-line
|
s.fixtures.symlink_file("dir/pipe", "sympipe"); // spell-checker:disable-line
|
||||||
let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); // spell-checker:disable-line
|
let proc = s.ucmd().args(&["sympipe"]).run_no_wait(); // spell-checker:disable-line
|
||||||
|
|
||||||
let data = vec_of_size(128 * 1024);
|
let data = vec_of_size(128 * 1024);
|
||||||
let data2 = data.clone();
|
let data2 = data.clone();
|
||||||
|
@ -111,7 +111,7 @@ fn test_piped_to_regular_file() {
|
||||||
.succeeds();
|
.succeeds();
|
||||||
}
|
}
|
||||||
let contents = read_to_string(&file_path).unwrap();
|
let contents = read_to_string(&file_path).unwrap();
|
||||||
assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line
|
assert_eq!(contents, "abcde\nfghij\nklmno\npqrst\nuvwxyz\n"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ fn test_three_directories_and_file_and_stdin() {
|
||||||
"alpha.txt",
|
"alpha.txt",
|
||||||
"-",
|
"-",
|
||||||
"file_which_does_not_exist.txt",
|
"file_which_does_not_exist.txt",
|
||||||
"nonewline.txt", // spell-checker:disable-line
|
"nonewline.txt", // spell-checker:disable-line
|
||||||
"test_directory3/test_directory5",
|
"test_directory3/test_directory5",
|
||||||
"test_directory3/../test_directory3/test_directory5",
|
"test_directory3/../test_directory3/test_directory5",
|
||||||
"test_directory3",
|
"test_directory3",
|
||||||
|
@ -202,7 +202,7 @@ fn test_three_directories_and_file_and_stdin() {
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
|
.stderr_is_fixture("three_directories_and_file_and_stdin.stderr.expected")
|
||||||
.stdout_is(
|
.stdout_is(
|
||||||
"abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", // spell-checker:disable-line
|
"abcde\nfghij\nklmno\npqrst\nuvwxyz\nstdout bytestext without a trailing newline", // spell-checker:disable-line
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn a_empty() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["a", "empty"])
|
.args(&["a", "empty"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only_fixture("aempty.expected"); // spell-checker:disable-line
|
.stdout_only_fixture("aempty.expected"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -181,7 +181,7 @@ fn test_date_set_valid_2() {
|
||||||
if get_effective_uid() == 0 {
|
if get_effective_uid() == 0 {
|
||||||
let result = new_ucmd!()
|
let result = new_ucmd!()
|
||||||
.arg("--set")
|
.arg("--set")
|
||||||
.arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line
|
.arg("Sat 20 Mar 2021 14:53:01 AWST") // spell-checker:disable-line
|
||||||
.fails();
|
.fails();
|
||||||
result.no_stdout();
|
result.no_stdout();
|
||||||
assert!(result.stderr_str().starts_with("date: invalid date "));
|
assert!(result.stderr_str().starts_with("date: invalid date "));
|
||||||
|
|
|
@ -35,9 +35,9 @@ fn test_str_utils() {
|
||||||
assert_eq!("asd#zcv", s.purify());
|
assert_eq!("asd#zcv", s.purify());
|
||||||
|
|
||||||
let s = "con256asd";
|
let s = "con256asd";
|
||||||
assert!(s.fnmatch("*[2][3-6][5-9]?sd")); // spell-checker:disable-line
|
assert!(s.fnmatch("*[2][3-6][5-9]?sd")); // spell-checker:disable-line
|
||||||
|
|
||||||
let s = "zxc \t\nqwe jlk hjl"; // spell-checker:disable-line
|
let s = "zxc \t\nqwe jlk hjl"; // spell-checker:disable-line
|
||||||
let (k, v) = s.split_two();
|
let (k, v) = s.split_two();
|
||||||
assert_eq!("zxc", k);
|
assert_eq!("zxc", k);
|
||||||
assert_eq!("qwe jlk hjl", v);
|
assert_eq!("qwe jlk hjl", v);
|
||||||
|
|
|
@ -189,7 +189,7 @@ fn test_hyphen_values_inside_string() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") // spell-checker:disable-line
|
.arg("'\"\n'CXXFLAGS=-g -O2'\n\"'") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_contains("CXXFLAGS"); // spell-checker:disable-line
|
.stdout_contains("CXXFLAGS"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -209,7 +209,10 @@ fn test_big_primes() {
|
||||||
|
|
||||||
fn run(input_string: &[u8], output_string: &[u8]) {
|
fn run(input_string: &[u8], output_string: &[u8]) {
|
||||||
println!("STDIN='{}'", String::from_utf8_lossy(input_string));
|
println!("STDIN='{}'", String::from_utf8_lossy(input_string));
|
||||||
println!("STDOUT(expected)='{}'", String::from_utf8_lossy(output_string));
|
println!(
|
||||||
|
"STDOUT(expected)='{}'",
|
||||||
|
String::from_utf8_lossy(output_string)
|
||||||
|
);
|
||||||
// now run factor
|
// now run factor
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.pipe_in(input_string)
|
.pipe_in(input_string)
|
||||||
|
|
|
@ -282,7 +282,7 @@ fn test_backspace_is_not_word_boundary() {
|
||||||
.args(&["-w10", "-s"])
|
.args(&["-w10", "-s"])
|
||||||
.pipe_in("foobar\x086789abcdef")
|
.pipe_in("foobar\x086789abcdef")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("foobar\x086789a\nbcdef"); // spell-checker:disable-line
|
.stdout_is("foobar\x086789a\nbcdef"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -308,9 +308,9 @@ fn test_carriage_return_should_reset_column_count() {
|
||||||
fn test_carriage_return_is_not_word_boundary() {
|
fn test_carriage_return_is_not_word_boundary() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["-w6", "-s"])
|
.args(&["-w6", "-s"])
|
||||||
.pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
|
.pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("fizz\rbuzz\rfizzbu\nzz"); // spell-checker:disable-line
|
.stdout_is("fizz\rbuzz\rfizzbu\nzz"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -530,7 +530,7 @@ fn test_bytewise_carriage_return_should_not_reset_column_count() {
|
||||||
fn test_bytewise_carriage_return_is_not_word_boundary() {
|
fn test_bytewise_carriage_return_is_not_word_boundary() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["-w6", "-s", "-b"])
|
.args(&["-w6", "-s", "-b"])
|
||||||
.pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
|
.pipe_in("fizz\rbuzz\rfizzbuzz") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line
|
.stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ fn test_kill_set_bad_signal_name() {
|
||||||
// spell-checker:disable-line
|
// spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-s")
|
.arg("-s")
|
||||||
.arg("IAMNOTASIGNAL") // spell-checker:disable-line
|
.arg("IAMNOTASIGNAL") // spell-checker:disable-line
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_contains("unknown signal");
|
.stderr_contains("unknown signal");
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ fn test_symlink_interactive() {
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.args(&["-i", "-s", file, link])
|
.args(&["-i", "-s", file, link])
|
||||||
.pipe_in("Yesh") // spell-checker:disable-line
|
.pipe_in("Yesh") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.no_stderr();
|
.no_stderr();
|
||||||
|
|
||||||
|
|
|
@ -941,7 +941,7 @@ fn test_ls_color() {
|
||||||
|
|
||||||
let a_with_colors = "\x1b[1;34ma\x1b[0m";
|
let a_with_colors = "\x1b[1;34ma\x1b[0m";
|
||||||
let z_with_colors = "\x1b[1;34mz\x1b[0m";
|
let z_with_colors = "\x1b[1;34mz\x1b[0m";
|
||||||
let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // spell-checker:disable-line
|
let nested_dir_with_colors = "\x1b[1;34mnested_dir\x1b[0m"; // spell-checker:disable-line
|
||||||
|
|
||||||
// Color is disabled by default
|
// Color is disabled by default
|
||||||
let result = scene.ucmd().succeeds();
|
let result = scene.ucmd().succeeds();
|
||||||
|
|
|
@ -10,8 +10,8 @@ static TEST_TEMPLATE2: &str = "temp";
|
||||||
static TEST_TEMPLATE3: &str = "tempX";
|
static TEST_TEMPLATE3: &str = "tempX";
|
||||||
static TEST_TEMPLATE4: &str = "tempXX";
|
static TEST_TEMPLATE4: &str = "tempXX";
|
||||||
static TEST_TEMPLATE5: &str = "tempXXX";
|
static TEST_TEMPLATE5: &str = "tempXXX";
|
||||||
static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line
|
static TEST_TEMPLATE6: &str = "tempXXXlate"; // spell-checker:disable-line
|
||||||
static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line
|
static TEST_TEMPLATE7: &str = "XXXtemplate"; // spell-checker:disable-line
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
static TEST_TEMPLATE8: &str = "tempXXXl/ate";
|
static TEST_TEMPLATE8: &str = "tempXXXl/ate";
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|
|
@ -5,7 +5,8 @@ fn test_more_no_arg() {
|
||||||
// Reading from stdin is now supported, so this must succeed
|
// Reading from stdin is now supported, so this must succeed
|
||||||
if atty::is(atty::Stream::Stdout) {
|
if atty::is(atty::Stream::Stdout) {
|
||||||
new_ucmd!().succeeds();
|
new_ucmd!().succeeds();
|
||||||
} else {}
|
} else {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -19,5 +20,6 @@ fn test_more_dir_arg() {
|
||||||
const EXPECTED_ERROR_MESSAGE: &str =
|
const EXPECTED_ERROR_MESSAGE: &str =
|
||||||
"more: '.' is a directory.\nTry 'more --help' for more information.";
|
"more: '.' is a directory.\nTry 'more --help' for more information.";
|
||||||
assert_eq!(result.stderr_str().trim(), EXPECTED_ERROR_MESSAGE);
|
assert_eq!(result.stderr_str().trim(), EXPECTED_ERROR_MESSAGE);
|
||||||
} else {}
|
} else {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ fn test_mv_interactive() {
|
||||||
.arg("-i")
|
.arg("-i")
|
||||||
.arg(file_a)
|
.arg(file_a)
|
||||||
.arg(file_b)
|
.arg(file_b)
|
||||||
.pipe_in("Yesh") // spell-checker:disable-line
|
.pipe_in("Yesh") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.no_stderr();
|
.no_stderr();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ fn test_negative_adjustment() {
|
||||||
let res = new_ucmd!().args(&["-n", "-1", "true"]).run();
|
let res = new_ucmd!().args(&["-n", "-1", "true"]).run();
|
||||||
assert!(res
|
assert!(res
|
||||||
.stderr_str()
|
.stderr_str()
|
||||||
.starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line
|
.starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -81,7 +81,7 @@ fn test_2files() {
|
||||||
fn test_no_file() {
|
fn test_no_file() {
|
||||||
let temp = env::temp_dir();
|
let temp = env::temp_dir();
|
||||||
let tmpdir = Path::new(&temp);
|
let tmpdir = Path::new(&temp);
|
||||||
let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line
|
let file = tmpdir.join("}surely'none'would'thus'a'file'name"); // spell-checker:disable-line
|
||||||
|
|
||||||
new_ucmd!().arg(file.as_os_str()).fails();
|
new_ucmd!().arg(file.as_os_str()).fails();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ fn test_no_file() {
|
||||||
// Test that od reads from stdin instead of a file
|
// Test that od reads from stdin instead of a file
|
||||||
#[test]
|
#[test]
|
||||||
fn test_from_stdin() {
|
fn test_from_stdin() {
|
||||||
let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--endian=little")
|
.arg("--endian=little")
|
||||||
.run_piped_stdin(input.as_bytes())
|
.run_piped_stdin(input.as_bytes())
|
||||||
|
@ -128,7 +128,7 @@ fn test_from_mixed() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_multiple_formats() {
|
fn test_multiple_formats() {
|
||||||
let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopqrstuvwxyz\n"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("-b")
|
.arg("-b")
|
||||||
|
@ -294,7 +294,7 @@ fn test_multibyte() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("-w12")
|
.arg("-w12")
|
||||||
.run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) // spell-checker:disable-line
|
.run_piped_stdin("Universität Tübingen \u{1B000}".as_bytes()) // spell-checker:disable-line
|
||||||
.success()
|
.success()
|
||||||
.no_stderr()
|
.no_stderr()
|
||||||
.stdout_is(unindent(
|
.stdout_is(unindent(
|
||||||
|
@ -511,7 +511,7 @@ fn test_max_uint() {
|
||||||
|
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--format=o8")
|
.arg("--format=o8")
|
||||||
.arg("-Oobtu8") // spell-checker:disable-line
|
.arg("-Oobtu8") // spell-checker:disable-line
|
||||||
.arg("-Dd")
|
.arg("-Dd")
|
||||||
.arg("--format=u1")
|
.arg("--format=u1")
|
||||||
.run_piped_stdin(&input[..])
|
.run_piped_stdin(&input[..])
|
||||||
|
@ -589,7 +589,7 @@ fn test_invalid_offset() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_skip_bytes() {
|
fn test_skip_bytes() {
|
||||||
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("--skip-bytes=5")
|
.arg("--skip-bytes=5")
|
||||||
|
@ -615,7 +615,7 @@ fn test_skip_bytes_error() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_read_bytes() {
|
fn test_read_bytes() {
|
||||||
let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopqrstuvwxyz\n12345678"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--endian=little")
|
.arg("--endian=little")
|
||||||
.arg("--read-bytes=27")
|
.arg("--read-bytes=27")
|
||||||
|
@ -674,7 +674,7 @@ fn test_filename_parsing() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_stdin_offset() {
|
fn test_stdin_offset() {
|
||||||
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg("+5")
|
.arg("+5")
|
||||||
|
@ -709,7 +709,7 @@ fn test_file_offset() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_traditional() {
|
fn test_traditional() {
|
||||||
// note gnu od does not align both lines
|
// note gnu od does not align both lines
|
||||||
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopq"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--traditional")
|
.arg("--traditional")
|
||||||
.arg("-a")
|
.arg("-a")
|
||||||
|
@ -732,7 +732,7 @@ fn test_traditional() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_traditional_with_skip_bytes_override() {
|
fn test_traditional_with_skip_bytes_override() {
|
||||||
// --skip-bytes is ignored in this case
|
// --skip-bytes is ignored in this case
|
||||||
let input = "abcdefghijklmnop"; // spell-checker:disable-line
|
let input = "abcdefghijklmnop"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--traditional")
|
.arg("--traditional")
|
||||||
.arg("--skip-bytes=10")
|
.arg("--skip-bytes=10")
|
||||||
|
@ -752,7 +752,7 @@ fn test_traditional_with_skip_bytes_override() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_traditional_with_skip_bytes_non_override() {
|
fn test_traditional_with_skip_bytes_non_override() {
|
||||||
// no offset specified in the traditional way, so --skip-bytes is used
|
// no offset specified in the traditional way, so --skip-bytes is used
|
||||||
let input = "abcdefghijklmnop"; // spell-checker:disable-line
|
let input = "abcdefghijklmnop"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("--traditional")
|
.arg("--traditional")
|
||||||
.arg("--skip-bytes=10")
|
.arg("--skip-bytes=10")
|
||||||
|
@ -782,7 +782,7 @@ fn test_traditional_error() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_traditional_only_label() {
|
fn test_traditional_only_label() {
|
||||||
let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line
|
let input = "abcdefghijklmnopqrstuvwxyz"; // spell-checker:disable-line
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-An")
|
.arg("-An")
|
||||||
.arg("--traditional")
|
.arg("--traditional")
|
||||||
|
|
|
@ -9,9 +9,9 @@ pub use self::pinky::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_capitalize() {
|
fn test_capitalize() {
|
||||||
assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line
|
assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line
|
||||||
assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line
|
assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line
|
||||||
assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line
|
assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line
|
||||||
assert_eq!("", "".capitalize());
|
assert_eq!("", "".capitalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -401,7 +401,7 @@ fn sub_any_asterisk_hex_arg() {
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_any_specifiers_no_params() {
|
fn sub_any_specifiers_no_params() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["%ztlhLji", "3"]) //spell-checker:disable-line
|
.args(&["%ztlhLji", "3"]) //spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("3");
|
.stdout_only("3");
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ fn sub_any_specifiers_no_params() {
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_any_specifiers_after_first_param() {
|
fn sub_any_specifiers_after_first_param() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["%0ztlhLji", "3"]) //spell-checker:disable-line
|
.args(&["%0ztlhLji", "3"]) //spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("3");
|
.stdout_only("3");
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ fn sub_any_specifiers_after_first_param() {
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_any_specifiers_after_period() {
|
fn sub_any_specifiers_after_period() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["%0.ztlhLji", "3"]) //spell-checker:disable-line
|
.args(&["%0.ztlhLji", "3"]) //spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("3");
|
.stdout_only("3");
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ fn sub_any_specifiers_after_period() {
|
||||||
#[test]
|
#[test]
|
||||||
fn sub_any_specifiers_after_second_param() {
|
fn sub_any_specifiers_after_second_param() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["%0.0ztlhLji", "3"]) //spell-checker:disable-line
|
.args(&["%0.0ztlhLji", "3"]) //spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("3");
|
.stdout_only("3");
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ fn test_relpath_with_from_with_d() {
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg(to)
|
.arg(to)
|
||||||
.arg(from)
|
.arg(from)
|
||||||
.arg("-dnon_existing") // spell-checker:disable-line
|
.arg("-dnon_existing") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_move_str();
|
.stdout_move_str();
|
||||||
assert!(Path::new(&_result_stdout).is_absolute());
|
assert!(Path::new(&_result_stdout).is_absolute());
|
||||||
|
@ -170,7 +170,7 @@ fn test_relpath_no_from_with_d() {
|
||||||
let result_stdout = scene
|
let result_stdout = scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg(to)
|
.arg(to)
|
||||||
.arg("-dnon_existing") // spell-checker:disable-line
|
.arg("-dnon_existing") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_move_str();
|
.stdout_move_str();
|
||||||
assert!(Path::new(&result_stdout).is_absolute());
|
assert!(Path::new(&result_stdout).is_absolute());
|
||||||
|
|
|
@ -65,7 +65,7 @@ fn test_rm_interactive() {
|
||||||
.arg("-i")
|
.arg("-i")
|
||||||
.arg(file_a)
|
.arg(file_a)
|
||||||
.arg(file_b)
|
.arg(file_b)
|
||||||
.pipe_in("Yesh") // spell-checker:disable-line
|
.pipe_in("Yesh") // spell-checker:disable-line
|
||||||
.succeeds();
|
.succeeds();
|
||||||
|
|
||||||
assert!(!at.file_exists(file_a));
|
assert!(!at.file_exists(file_a));
|
||||||
|
|
|
@ -292,10 +292,10 @@ fn test_dictionary_order() {
|
||||||
fn test_dictionary_order2() {
|
fn test_dictionary_order2() {
|
||||||
for non_dictionary_order2_param in &["-d"] {
|
for non_dictionary_order2_param in &["-d"] {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line
|
.pipe_in("a👦🏻aa b\naaaa b") // spell-checker:disable-line
|
||||||
.arg(non_dictionary_order2_param) // spell-checker:disable-line
|
.arg(non_dictionary_order2_param) // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line
|
.stdout_only("a👦🏻aa b\naaaa b\n"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,10 +303,10 @@ fn test_dictionary_order2() {
|
||||||
fn test_non_printing_chars() {
|
fn test_non_printing_chars() {
|
||||||
for non_printing_chars_param in &["-i"] {
|
for non_printing_chars_param in &["-i"] {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line
|
.pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line
|
||||||
.arg(non_printing_chars_param) // spell-checker:disable-line
|
.arg(non_printing_chars_param) // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line
|
.stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ fn test_scanners() {
|
||||||
assert_eq!(None, "z192zxc".scan_num::<i32>());
|
assert_eq!(None, "z192zxc".scan_num::<i32>());
|
||||||
|
|
||||||
assert_eq!(Some(('a', 3)), "141zxc".scan_char(8));
|
assert_eq!(Some(('a', 3)), "141zxc".scan_char(8));
|
||||||
assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); // spell-checker:disable-line
|
assert_eq!(Some(('\n', 2)), "12qzxc".scan_char(8)); // spell-checker:disable-line
|
||||||
assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); // spell-checker:disable-line
|
assert_eq!(Some(('\r', 1)), "dqzxc".scan_char(16)); // spell-checker:disable-line
|
||||||
assert_eq!(None, "z2qzxc".scan_char(8)); // spell-checker:disable-line
|
assert_eq!(None, "z2qzxc".scan_char(8)); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -268,7 +268,7 @@ fn test_parse_size() {
|
||||||
assert!(parse_size("1Y").is_err());
|
assert!(parse_size("1Y").is_err());
|
||||||
|
|
||||||
// Bad number
|
// Bad number
|
||||||
assert!(parse_size("328hdsf3290").is_err()); // spell-checker:disable-line
|
assert!(parse_size("328hdsf3290").is_err()); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -210,7 +210,7 @@ fn test_pseudofloat_not_equal() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_negative_arg_is_a_string() {
|
fn test_negative_arg_is_a_string() {
|
||||||
new_ucmd!().arg("-12345").succeeds();
|
new_ucmd!().arg("-12345").succeeds();
|
||||||
new_ucmd!().arg("--qwert").succeeds(); // spell-checker:disable-line
|
new_ucmd!().arg("--qwert").succeeds(); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -140,9 +140,9 @@ fn test_translate_and_squeeze() {
|
||||||
fn test_translate_and_squeeze_multiple_lines() {
|
fn test_translate_and_squeeze_multiple_lines() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["-s", "x", "y"])
|
.args(&["-s", "x", "y"])
|
||||||
.pipe_in("xxaax\nxaaxx") // spell-checker:disable-line
|
.pipe_in("xxaax\nxaaxx") // spell-checker:disable-line
|
||||||
.run()
|
.run()
|
||||||
.stdout_is("yaay\nyaay"); // spell-checker:disable-line
|
.stdout_is("yaay\nyaay"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -169,7 +169,7 @@ fn test_set1_longer_than_set2() {
|
||||||
.args(&["abc", "xy"])
|
.args(&["abc", "xy"])
|
||||||
.pipe_in("abcde")
|
.pipe_in("abcde")
|
||||||
.run()
|
.run()
|
||||||
.stdout_is("xyyde"); // spell-checker:disable-line
|
.stdout_is("xyyde"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -178,7 +178,7 @@ fn test_set1_shorter_than_set2() {
|
||||||
.args(&["ab", "xyz"])
|
.args(&["ab", "xyz"])
|
||||||
.pipe_in("abcde")
|
.pipe_in("abcde")
|
||||||
.run()
|
.run()
|
||||||
.stdout_is("xycde"); // spell-checker:disable-line
|
.stdout_is("xycde"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -187,7 +187,7 @@ fn test_truncate() {
|
||||||
.args(&["-t", "abc", "xy"])
|
.args(&["-t", "abc", "xy"])
|
||||||
.pipe_in("abcde")
|
.pipe_in("abcde")
|
||||||
.run()
|
.run()
|
||||||
.stdout_is("xycde"); // spell-checker:disable-line
|
.stdout_is("xycde"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -196,7 +196,7 @@ fn test_truncate_with_set1_shorter_than_set2() {
|
||||||
.args(&["-t", "ab", "xyz"])
|
.args(&["-t", "ab", "xyz"])
|
||||||
.pipe_in("abcde")
|
.pipe_in("abcde")
|
||||||
.run()
|
.run()
|
||||||
.stdout_is("xycde"); // spell-checker:disable-line
|
.stdout_is("xycde"); // spell-checker:disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -216,8 +216,8 @@ fn missing_required_second_arg_fails() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_interpret_backslash_escapes() {
|
fn test_interpret_backslash_escapes() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) // spell-checker:disable-line
|
.args(&["abfnrtv", r"\a\b\f\n\r\t\v"]) // spell-checker:disable-line
|
||||||
.pipe_in("abfnrtv") // spell-checker:disable-line
|
.pipe_in("abfnrtv") // spell-checker:disable-line
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}");
|
.stdout_is("\u{7}\u{8}\u{c}\n\r\t\u{b}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,12 +47,7 @@ fn test_reference() {
|
||||||
|
|
||||||
scene.ucmd().arg("-s").arg("+5KB").arg(FILE1).run();
|
scene.ucmd().arg("-s").arg("+5KB").arg(FILE1).run();
|
||||||
|
|
||||||
scene
|
scene.ucmd().arg("--reference").arg(FILE1).arg(FILE2).run();
|
||||||
.ucmd()
|
|
||||||
.arg("--reference")
|
|
||||||
.arg(FILE1)
|
|
||||||
.arg(FILE2)
|
|
||||||
.run();
|
|
||||||
|
|
||||||
file.seek(SeekFrom::End(0)).unwrap();
|
file.seek(SeekFrom::End(0)).unwrap();
|
||||||
let actual = file.seek(SeekFrom::Current(0)).unwrap();
|
let actual = file.seek(SeekFrom::Current(0)).unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue