Use raw string literals in tests

This commit is contained in:
Nigel Andrews
2022-10-07 12:28:25 +02:00
parent 00a6586efe
commit 3b189080d4

View File

@@ -462,7 +462,7 @@ mod tests {
let mut doc = Document::default();
doc.add_bytes(bytes_field, "this is a test".as_bytes());
let json_string = schema.to_json(&doc);
assert_eq!(json_string, "{\"my_bytes\":[\"dGhpcyBpcyBhIHRlc3Q=\"]}");
assert_eq!(json_string, r#"{"my_bytes":["dGhpcyBpcyBhIHRlc3Q="]}"#);
}
#[test]
@@ -474,7 +474,7 @@ mod tests {
let mut doc = Document::default();
doc.add_bytes(bytes_field, "".as_bytes());
let json_string = schema.to_json(&doc);
assert_eq!(json_string, "{\"my_bytes\":[\"\"]}");
assert_eq!(json_string, r#"{"my_bytes":[""]}"#);
}
#[test]
@@ -491,7 +491,7 @@ mod tests {
let json_string = schema.to_json(&doc);
assert_eq!(
json_string,
"{\"my_bytes\":[\"QSBiaWdnZXIgdGVzdCBJIGd1ZXNzCnNwYW5uaW5nIG9uIG11bHRpcGxlIGxpbmVzCmhvcGluZyB0aGlzIHdpbGwgd29yaw==\"]}"
r#"{"my_bytes":["QSBiaWdnZXIgdGVzdCBJIGd1ZXNzCnNwYW5uaW5nIG9uIG11bHRpcGxlIGxpbmVzCmhvcGluZyB0aGlzIHdpbGwgd29yaw=="]}"#
);
}