Skip to content

Commit 2bc44af

Browse files
committed
test: add test for percent_encode_byte_array
1 parent a62ae82 commit 2bc44af

File tree

1 file changed

+16
-0
lines changed
  • packages/tracker-client/src/http

1 file changed

+16
-0
lines changed

packages/tracker-client/src/http/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,19 @@ impl InfoHash {
2424
self.0
2525
}
2626
}
27+
28+
#[cfg(test)]
29+
mod tests {
30+
use crate::http::percent_encode_byte_array;
31+
32+
#[test]
33+
fn it_should_encode_a_20_byte_array() {
34+
assert_eq!(
35+
percent_encode_byte_array(&[
36+
0x3b, 0x24, 0x55, 0x04, 0xcf, 0x5f, 0x11, 0xbb, 0xdb, 0xe1, 0x20, 0x1c, 0xea, 0x6a, 0x6b, 0xf4, 0x5a, 0xee, 0x1b,
37+
0xc0,
38+
]),
39+
"%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0"
40+
);
41+
}
42+
}

0 commit comments

Comments
 (0)