Skip to content

Commit 2c67775

Browse files
authored
Merge pull request #6258 from sylvestre/touch
Minor nits in the tests
2 parents fed1664 + 13cfe2d commit 2c67775

File tree

2 files changed

+49
-49
lines changed

2 files changed

+49
-49
lines changed

tests/by-util/test_hashsum.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ fn test_check_strict_error() {
504504
let scene = TestScenario::new(util_name!());
505505
let at = &scene.fixtures;
506506

507-
at.write("f", "");
507+
at.touch("f");
508508
at.write(
509509
"in.md5",
510510
"ERR\nERR\nd41d8cd98f00b204e9800998ecf8427e f\nERR\n",
@@ -523,7 +523,7 @@ fn test_check_warn() {
523523
let scene = TestScenario::new(util_name!());
524524
let at = &scene.fixtures;
525525

526-
at.write("f", "");
526+
at.touch("f");
527527
at.write(
528528
"in.md5",
529529
"d41d8cd98f00b204e9800998ecf8427e f\nd41d8cd98f00b204e9800998ecf8427e f\ninvalid\n",
@@ -551,7 +551,7 @@ fn test_check_status() {
551551
let scene = TestScenario::new(util_name!());
552552
let at = &scene.fixtures;
553553

554-
at.write("f", "");
554+
at.touch("f");
555555
at.write("in.md5", "MD5(f)= d41d8cd98f00b204e9800998ecf8427f\n");
556556
scene
557557
.ccmd("md5sum")
@@ -567,7 +567,7 @@ fn test_check_status_code() {
567567
let scene = TestScenario::new(util_name!());
568568
let at = &scene.fixtures;
569569

570-
at.write("f", "");
570+
at.touch("f");
571571
at.write("in.md5", "d41d8cd98f00b204e9800998ecf8427f f\n");
572572
scene
573573
.ccmd("md5sum")
@@ -584,7 +584,7 @@ fn test_check_no_backslash_no_space() {
584584
let scene = TestScenario::new(util_name!());
585585
let at = &scene.fixtures;
586586

587-
at.write("f", "");
587+
at.touch("f");
588588
at.write("in.md5", "MD5(f)= d41d8cd98f00b204e9800998ecf8427e\n");
589589
scene
590590
.ccmd("md5sum")
@@ -599,7 +599,7 @@ fn test_check_check_ignore_no_file() {
599599
let scene = TestScenario::new(util_name!());
600600
let at = &scene.fixtures;
601601

602-
at.write("f", "");
602+
at.touch("f");
603603
at.write("in.md5", "d41d8cd98f00b204e9800998ecf8427f missing\n");
604604
scene
605605
.ccmd("md5sum")

tests/by-util/test_tail.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3620,19 +3620,19 @@ fn test_when_argument_file_is_non_existent_unix_socket_address_then_error() {
36203620
#[cfg(disabled_until_fixed)]
36213621
fn test_when_argument_files_are_simple_combinations_of_stdin_and_regular_file() {
36223622
let scene = TestScenario::new(util_name!());
3623-
let fixtures = &scene.fixtures;
3623+
let at = &scene.fixtures;
36243624

3625-
fixtures.write("empty", "");
3626-
fixtures.write("data", "file data");
3627-
fixtures.write("fifo", "fifo data");
3625+
at.touch("empty");
3626+
at.write("data", "file data");
3627+
at.write("fifo", "fifo data");
36283628

36293629
let expected = "==> standard input <==\n\
36303630
fifo data\n\
36313631
==> empty <==\n";
36323632
scene
36333633
.ucmd()
36343634
.args(&["-c", "+0", "-", "empty"])
3635-
.set_stdin(File::open(fixtures.plus("fifo")).unwrap())
3635+
.set_stdin(File::open(at.plus("fifo")).unwrap())
36363636
.run()
36373637
.success()
36383638
.stdout_only(expected);
@@ -3666,7 +3666,7 @@ fn test_when_argument_files_are_simple_combinations_of_stdin_and_regular_file()
36663666
scene
36673667
.ucmd()
36683668
.args(&["-c", "+0", "empty", "-"])
3669-
.set_stdin(File::open(fixtures.plus("fifo")).unwrap())
3669+
.set_stdin(File::open(at.plus("fifo")).unwrap())
36703670
.run()
36713671
.success()
36723672
.stdout_only(expected);
@@ -3712,7 +3712,7 @@ fn test_when_argument_files_are_simple_combinations_of_stdin_and_regular_file()
37123712
scene
37133713
.ucmd()
37143714
.args(&["-c", "+0", "-", "-"])
3715-
.set_stdin(File::open(fixtures.plus("fifo")).unwrap())
3715+
.set_stdin(File::open(at.plus("fifo")).unwrap())
37163716
.run()
37173717
.success()
37183718
.stdout_only(expected);
@@ -3722,11 +3722,11 @@ fn test_when_argument_files_are_simple_combinations_of_stdin_and_regular_file()
37223722
#[cfg(disabled_until_fixed)]
37233723
fn test_when_argument_files_are_triple_combinations_of_fifo_pipe_and_regular_file() {
37243724
let scene = TestScenario::new(util_name!());
3725-
let fixtures = &scene.fixtures;
3725+
let at = &scene.fixtures;
37263726

3727-
fixtures.write("empty", "");
3728-
fixtures.write("data", "file data");
3729-
fixtures.write("fifo", "fifo data");
3727+
at.touch("empty");
3728+
at.write("data", "file data");
3729+
at.write("fifo", "fifo data");
37303730

37313731
let expected = "==> standard input <==\n\
37323732
\n\
@@ -3737,7 +3737,7 @@ fn test_when_argument_files_are_triple_combinations_of_fifo_pipe_and_regular_fil
37373737
scene
37383738
.ucmd()
37393739
.args(&["-c", "+0", "-", "empty", "-"])
3740-
.set_stdin(File::open(fixtures.plus("empty")).unwrap())
3740+
.set_stdin(File::open(at.plus("empty")).unwrap())
37413741
.run()
37423742
.stdout_only(expected)
37433743
.success();
@@ -3817,7 +3817,7 @@ fn test_when_argument_files_are_triple_combinations_of_fifo_pipe_and_regular_fil
38173817
scene
38183818
.ucmd()
38193819
.args(&["-c", "+0", "-", "data", "-"])
3820-
.set_stdin(File::open(fixtures.plus("fifo")).unwrap())
3820+
.set_stdin(File::open(at.plus("fifo")).unwrap())
38213821
.run()
38223822
.stdout_only(expected)
38233823
.success();
@@ -3833,10 +3833,10 @@ fn test_when_argument_files_are_triple_combinations_of_fifo_pipe_and_regular_fil
38333833
#[cfg(disable_until_fixed)]
38343834
fn test_when_follow_retry_then_initial_print_of_file_is_written_to_stdout() {
38353835
let scene = TestScenario::new(util_name!());
3836-
let fixtures = &scene.fixtures;
3836+
let at = &scene.fixtures;
38373837

38383838
let expected_stdout = "file data";
3839-
fixtures.write("data", expected_stdout);
3839+
at.write("data", expected_stdout);
38403840

38413841
let mut child = scene
38423842
.ucmd()
@@ -3855,10 +3855,10 @@ fn test_when_follow_retry_then_initial_print_of_file_is_written_to_stdout() {
38553855
#[test]
38563856
fn test_args_when_settings_check_warnings_then_shows_warnings() {
38573857
let scene = TestScenario::new(util_name!());
3858-
let fixtures = &scene.fixtures;
3858+
let at = &scene.fixtures;
38593859

38603860
let file_data = "file data\n";
3861-
fixtures.write("data", file_data);
3861+
at.write("data", file_data);
38623862

38633863
let expected_stdout = format!(
38643864
"tail: warning: --retry ignored; --retry is useful only when following\n\
@@ -4051,7 +4051,7 @@ fn test_args_when_settings_check_warnings_follow_indefinitely_then_warning() {
40514051
#[cfg(unix)]
40524052
fn test_args_when_settings_check_warnings_follow_indefinitely_then_no_warning() {
40534053
let scene = TestScenario::new(util_name!());
4054-
let fixtures = &scene.fixtures;
4054+
let at = &scene.fixtures;
40554055

40564056
#[cfg(target_vendor = "apple")]
40574057
let delay = 1000;
@@ -4062,8 +4062,8 @@ fn test_args_when_settings_check_warnings_follow_indefinitely_then_no_warning()
40624062
let fifo_data = "fifo data\n";
40634063
let fifo_name = "fifo";
40644064
let file_name = "data";
4065-
fixtures.write(file_name, file_data);
4066-
fixtures.write(fifo_name, fifo_data);
4065+
at.write(file_name, file_data);
4066+
at.write(fifo_name, fifo_data);
40674067

40684068
let pipe_data = "pipe data";
40694069
let expected_stdout = format!(
@@ -4106,7 +4106,7 @@ fn test_args_when_settings_check_warnings_follow_indefinitely_then_no_warning()
41064106
let mut child = scene
41074107
.ucmd()
41084108
.args(&["--follow=descriptor", "-", file_name])
4109-
.set_stdin(File::open(fixtures.plus(fifo_name)).unwrap())
4109+
.set_stdin(File::open(at.plus(fifo_name)).unwrap())
41104110
.stderr_to_stdout()
41114111
.run_no_wait();
41124112

@@ -4126,7 +4126,7 @@ fn test_args_when_settings_check_warnings_follow_indefinitely_then_no_warning()
41264126
let mut child = scene
41274127
.ucmd()
41284128
.args(&["--follow=descriptor", "--pid=0", "-", file_name])
4129-
.set_stdin(File::open(fixtures.plus(fifo_name)).unwrap())
4129+
.set_stdin(File::open(at.plus(fifo_name)).unwrap())
41304130
.stderr_to_stdout()
41314131
.run_no_wait();
41324132

@@ -4144,13 +4144,13 @@ fn test_args_when_settings_check_warnings_follow_indefinitely_then_no_warning()
41444144
#[cfg(disable_until_fixed)]
41454145
fn test_follow_when_files_are_pointing_to_same_relative_file_and_data_is_appended() {
41464146
let scene = TestScenario::new(util_name!());
4147-
let fixtures = &scene.fixtures;
4147+
let at = &scene.fixtures;
41484148

41494149
let file_data = "file data";
41504150
let relative_path_name = "data";
41514151

4152-
fixtures.write(relative_path_name, file_data);
4153-
let absolute_path = fixtures.plus("data").canonicalize().unwrap();
4152+
at.write(relative_path_name, file_data);
4153+
let absolute_path = at.plus("data").canonicalize().unwrap();
41544154

41554155
// run with relative path first and then the absolute path
41564156
let mut child = scene
@@ -4165,7 +4165,7 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_data_is_appende
41654165
let more_data = "more data";
41664166
child.delay(500);
41674167

4168-
fixtures.append(relative_path_name, more_data);
4168+
at.append(relative_path_name, more_data);
41694169

41704170
let expected_stdout = format!(
41714171
"==> {0} <==\n\
@@ -4190,7 +4190,7 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_data_is_appende
41904190
.stderr_only(expected_stdout);
41914191

41924192
// run with absolute path first and then the relative path
4193-
fixtures.write(relative_path_name, file_data);
4193+
at.write(relative_path_name, file_data);
41944194
let mut child = scene
41954195
.ucmd()
41964196
.args(&[
@@ -4202,7 +4202,7 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_data_is_appende
42024202

42034203
child.delay(500);
42044204
let more_data = "more data";
4205-
fixtures.append(relative_path_name, more_data);
4205+
at.append(relative_path_name, more_data);
42064206

42074207
let expected_stdout = format!(
42084208
"==> {0} <==\n\
@@ -4232,13 +4232,13 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_data_is_appende
42324232
#[cfg(disable_until_fixed)]
42334233
fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_is_truncated() {
42344234
let scene = TestScenario::new(util_name!());
4235-
let fixtures = &scene.fixtures;
4235+
let at = &scene.fixtures;
42364236

42374237
let file_data = "file data";
42384238
let relative_path_name = "data";
42394239

4240-
fixtures.write(relative_path_name, file_data);
4241-
let absolute_path = fixtures.plus("data").canonicalize().unwrap();
4240+
at.write(relative_path_name, file_data);
4241+
let absolute_path = at.plus("data").canonicalize().unwrap();
42424242

42434243
let mut child = scene
42444244
.ucmd()
@@ -4254,7 +4254,7 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_is_truncat
42544254

42554255
child.delay(500);
42564256
let less_data = "less";
4257-
fixtures.write(relative_path_name, "less");
4257+
at.write(relative_path_name, "less");
42584258

42594259
let expected_stdout = format!(
42604260
"==> {0} <==\n\
@@ -4285,14 +4285,14 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_is_truncat
42854285
#[cfg(disable_until_fixed)]
42864286
fn test_follow_when_file_and_symlink_are_pointing_to_same_file_and_append_data() {
42874287
let scene = TestScenario::new(util_name!());
4288-
let fixtures = &scene.fixtures;
4288+
let at = &scene.fixtures;
42894289

42904290
let file_data = "file data";
42914291
let path_name = "data";
42924292
let link_name = "link";
42934293

4294-
fixtures.write(path_name, file_data);
4295-
fixtures.symlink_file(path_name, link_name);
4294+
at.write(path_name, file_data);
4295+
at.symlink_file(path_name, link_name);
42964296

42974297
let mut child = scene
42984298
.ucmd()
@@ -4307,7 +4307,7 @@ fn test_follow_when_file_and_symlink_are_pointing_to_same_file_and_append_data()
43074307

43084308
child.delay(500);
43094309
let more_data = "more data";
4310-
fixtures.append(path_name, more_data);
4310+
at.append(path_name, more_data);
43114311

43124312
let expected_stdout = format!(
43134313
"==> {0} <==\n\
@@ -4331,7 +4331,7 @@ fn test_follow_when_file_and_symlink_are_pointing_to_same_file_and_append_data()
43314331
.with_current_output()
43324332
.stdout_only(expected_stdout);
43334333

4334-
fixtures.write(path_name, file_data);
4334+
at.write(path_name, file_data);
43354335
let mut child = scene
43364336
.ucmd()
43374337
.args(&[
@@ -4345,7 +4345,7 @@ fn test_follow_when_file_and_symlink_are_pointing_to_same_file_and_append_data()
43454345

43464346
child.delay(500);
43474347
let more_data = "more data";
4348-
fixtures.append(path_name, more_data);
4348+
at.append(path_name, more_data);
43494349

43504350
let expected_stdout = format!(
43514351
"==> {0} <==\n\
@@ -4373,10 +4373,10 @@ fn test_follow_when_file_and_symlink_are_pointing_to_same_file_and_append_data()
43734373
#[test]
43744374
fn test_args_when_directory_given_shorthand_big_f_together_with_retry() {
43754375
let scene = TestScenario::new(util_name!());
4376-
let fixtures = &scene.fixtures;
4376+
let at = &scene.fixtures;
43774377

43784378
let dirname = "dir";
4379-
fixtures.mkdir(dirname);
4379+
at.mkdir(dirname);
43804380
let expected_stderr = format!(
43814381
"tail: error reading '{0}': Is a directory\n\
43824382
tail: {0}: cannot follow end of this type of file\n",
@@ -4432,12 +4432,12 @@ fn test_args_when_directory_given_shorthand_big_f_together_with_retry() {
44324432
))]
44334433
fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same_size() {
44344434
let scene = TestScenario::new(util_name!());
4435-
let fixtures = &scene.fixtures;
4435+
let at = &scene.fixtures;
44364436

44374437
let file_data = "file data";
44384438
let relative_path_name = "data";
44394439

4440-
fixtures.write(relative_path_name, file_data);
4440+
at.write(relative_path_name, file_data);
44414441
let absolute_path = scene.fixtures.plus("data").canonicalize().unwrap();
44424442

44434443
let mut child = scene
@@ -4453,7 +4453,7 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same
44534453

44544454
child.delay(500);
44554455
let same_data = "same data"; // equal size to file_data
4456-
fixtures.write(relative_path_name, same_data);
4456+
at.write(relative_path_name, same_data);
44574457

44584458
let expected_stdout = format!(
44594459
"==> {0} <==\n\

0 commit comments

Comments
 (0)