mirror of
https://github.com/zerotier/common-utils.git
synced 2026-05-22 16:28:56 -07:00
Add unit test to str
This commit is contained in:
+11
@@ -6,6 +6,8 @@
|
||||
* https://www.zerotier.com/
|
||||
*/
|
||||
|
||||
use serde::de::Unexpected;
|
||||
|
||||
use crate::hex::HEX_CHARS;
|
||||
|
||||
/// Escape non-ASCII-printable characters in a string.
|
||||
@@ -54,3 +56,12 @@ pub fn unescape(s: &str) -> Vec<u8> {
|
||||
}
|
||||
b
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unescape() {
|
||||
let s = "\\000";
|
||||
let unescaped = unescape(s);
|
||||
let escaped = escape(&unescaped);
|
||||
assert_eq!(escaped, "\\000");
|
||||
assert_eq!(unescaped[0], 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user