khive-types 0.13.0

Core type primitives: Id128, Timestamp, Namespace, and the 3 substrate data types (Note, Entity, Event).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::escape_like_literal;

#[test]
fn escapes_only_like_wildcards_and_the_escape_character() {
    for (input, expected) in [
        ("", ""),
        ("plain text", "plain text"),
        ("%", "\\%"),
        ("_", "\\_"),
        ("\\", "\\\\"),
        ("name%_\\tail", "name\\%\\_\\\\tail"),
        ("中文_é%\\", "中文\\_é\\%\\\\"),
        ("quote' and \"double\"", "quote' and \"double\""),
    ] {
        assert_eq!(escape_like_literal(input), expected, "input={input:?}");
    }
}