mirror of
https://github.com/uutils/diffutils.git
synced 2026-06-10 15:48:59 -07:00
Replace only the first two occurences of timestamp regex
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ macro_rules! assert_diff_eq {
|
||||
|
||||
let diff = str::from_utf8(&$actual).unwrap();
|
||||
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ [+-]\d{4}").unwrap();
|
||||
let actual = re.replace_all(diff, "TIMESTAMP");
|
||||
let actual = re.replacen(diff, 2, "TIMESTAMP");
|
||||
|
||||
assert_eq!(actual, $expected);
|
||||
}};
|
||||
|
||||
+4
-1
@@ -154,7 +154,10 @@ mod tests {
|
||||
let current: String = current.format("%Y-%m-%d %H:%M:%S%.9f %z").to_string();
|
||||
|
||||
// verify
|
||||
assert_eq!(current, get_modification_time(&temp.path().to_string_lossy()));
|
||||
assert_eq!(
|
||||
current,
|
||||
get_modification_time(&temp.path().to_string_lossy())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user