1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2024-12-07 11:13:17 +02:00

Add more tests to replace_bytes

This commit is contained in:
Riccardo Attilio Galli 2024-02-04 09:53:57 -08:00
parent 006d224b2c
commit e077127eb8

View File

@ -582,6 +582,9 @@ and exhibited clearly, with a label attached.\
#[test]
fn replace() {
assert_eq!(replace_str("", b'b', b'z'), (s(""), None));
assert_eq!(replace_str("a", b'a', b'a'), (s("a"), None));
assert_eq!(replace_str("a", b'b', b'z'), (s("a"), None));
assert_eq!(replace_str("abc", b'b', b'z'), (s("azc"), Some(1)));
assert_eq!(replace_str("abb", b'b', b'z'), (s("azz"), Some(1)));
assert_eq!(replace_str("aba", b'a', b'z'), (s("zbz"), Some(0)));