Skip to content

Commit aedd068

Browse files
Replace only the first two occurences of timestamp regex
1 parent 54c02bd commit aedd068

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ macro_rules! assert_diff_eq {
1818

1919
let diff = str::from_utf8(&$actual).unwrap();
2020
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ [+-]\d{4}").unwrap();
21-
let actual = re.replace_all(diff, "TIMESTAMP");
21+
let actual = re.replacen(diff, 2, "TIMESTAMP");
2222

2323
assert_eq!(actual, $expected);
2424
}};

src/utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ mod tests {
154154
let current: String = current.format("%Y-%m-%d %H:%M:%S%.9f %z").to_string();
155155

156156
// verify
157-
assert_eq!(current, get_modification_time(&temp.path().to_string_lossy()));
157+
assert_eq!(
158+
current,
159+
get_modification_time(&temp.path().to_string_lossy())
160+
);
158161
}
159162

160163
#[test]

0 commit comments

Comments
 (0)