Skip to content

Commit c98af23

Browse files
committed
fix fmt issues
1 parent 9b2c6df commit c98af23

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

src/append/file.rs

+33-10
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,32 @@ mod test {
224224
let current_time = Local::now().format("%Y-%m-%d").to_string();
225225
let tempdir = tempfile::tempdir().unwrap();
226226
let builder = FileAppender::builder()
227-
.build(tempdir.path().join("foo").join("bar").join("logs/log-$TIME{%Y-%m-%d}.log"))
228-
.unwrap();
229-
let expected_path = tempdir.path().join(format!("foo/bar/logs/log-{}.log", current_time));
227+
.build(
228+
tempdir
229+
.path()
230+
.join("foo")
231+
.join("bar")
232+
.join("logs/log-$TIME{%Y-%m-%d}.log"),
233+
)
234+
.unwrap();
235+
let expected_path = tempdir
236+
.path()
237+
.join(format!("foo/bar/logs/log-{}.log", current_time));
230238
assert_eq!(builder.path, expected_path);
231239
}
232240

233241
#[test]
234242
fn test_date_time_format_with_invalid_format() {
235243
let tempdir = tempfile::tempdir().unwrap();
236244
let builder = FileAppender::builder()
237-
.build(tempdir.path().join("foo").join("bar").join("logs/log-$TIME{INVALID}.log"))
238-
.unwrap();
245+
.build(
246+
tempdir
247+
.path()
248+
.join("foo")
249+
.join("bar")
250+
.join("logs/log-$TIME{INVALID}.log"),
251+
)
252+
.unwrap();
239253
let expected_path = tempdir.path().join("foo/bar/logs/log-INVALID.log");
240254
assert_eq!(builder.path, expected_path);
241255
}
@@ -244,8 +258,8 @@ mod test {
244258
fn test_date_time_format_without_placeholder() {
245259
let tempdir = tempfile::tempdir().unwrap();
246260
let builder = FileAppender::builder()
247-
.build(tempdir.path().join("foo").join("bar").join("bar.log"))
248-
.unwrap();
261+
.build(tempdir.path().join("foo").join("bar").join("bar.log"))
262+
.unwrap();
249263
let expected_path = tempdir.path().join("foo/bar/bar.log");
250264
assert_eq!(builder.path, expected_path);
251265
}
@@ -255,9 +269,18 @@ mod test {
255269
let current_time = Local::now().format("%Y-%m-%d").to_string();
256270
let tempdir = tempfile::tempdir().unwrap();
257271
let builder = FileAppender::builder()
258-
.build(tempdir.path().join("foo").join("bar").join("logs-$TIME{%Y-%m-%d}/log-$TIME{%Y-%m-%d}.log"))
259-
.unwrap();
260-
let expected_path = tempdir.path().join(format!("foo/bar/logs-{}/log-{}.log", current_time, current_time));
272+
.build(
273+
tempdir
274+
.path()
275+
.join("foo")
276+
.join("bar")
277+
.join("logs-$TIME{%Y-%m-%d}/log-$TIME{%Y-%m-%d}.log"),
278+
)
279+
.unwrap();
280+
let expected_path = tempdir.path().join(format!(
281+
"foo/bar/logs-{}/log-{}.log",
282+
current_time, current_time
283+
));
261284
assert_eq!(builder.path, expected_path);
262285
}
263286
}

0 commit comments

Comments
 (0)