From b0bf3e7e0fc6d23ff26dbdeac56780169600cdee Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sat, 29 May 2021 19:34:17 +0200 Subject: [PATCH] pr: rustfmt test_pr.rs and utils.rs --- tests/by-util/test_pr.rs | 7 +++++-- tests/common/util.rs | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_pr.rs b/tests/by-util/test_pr.rs index 1cd8fbdc8..aae0cc058 100644 --- a/tests/by-util/test_pr.rs +++ b/tests/by-util/test_pr.rs @@ -1,7 +1,7 @@ use crate::common::util::*; -use std::fs::metadata; use chrono::offset::Local; use chrono::DateTime; +use std::fs::metadata; fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { let tmp_dir_path = ucmd.get_full_fixture_path(path); @@ -245,7 +245,10 @@ fn test_with_no_header_trailer_option() { scenario .args(&["-t", test_file_path]) .succeeds() - .stdout_is_templated_fixture(expected_test_file_path, vec![(&"{last_modified_time}".to_string(), &value)]); + .stdout_is_templated_fixture( + expected_test_file_path, + vec![(&"{last_modified_time}".to_string(), &value)], + ); } #[test] diff --git a/tests/common/util.rs b/tests/common/util.rs index cbe33e950..722417acf 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -226,8 +226,13 @@ impl CmdResult { } /// like stdout_is_fixture(...), but replaces the data in fixture file based on values provided in template_vars /// command output - pub fn stdout_is_templated_fixture>(&self, file_rel_path: T, template_vars: Vec<(&String, &String)>) -> &CmdResult { - let mut contents = String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); + pub fn stdout_is_templated_fixture>( + &self, + file_rel_path: T, + template_vars: Vec<(&String, &String)>, + ) -> &CmdResult { + let mut contents = + String::from_utf8(read_scenario_fixture(&self.tmpd, file_rel_path)).unwrap(); for kv in template_vars { contents = contents.replace(kv.0, kv.1); } @@ -923,7 +928,7 @@ impl UCommand { cmd_result } - pub fn get_full_fixture_path(&self, file_rel_path: &str) -> String{ + pub fn get_full_fixture_path(&self, file_rel_path: &str) -> String { let tmpdir_path = self.tmpd.as_ref().unwrap().path(); format!("{}/{}", tmpdir_path.to_str().unwrap(), file_rel_path) }