Skip to content

Commit 9f38ef6

Browse files
committed
feat!: include <string> tag for valid utf8 byte sequences
1 parent bc0fd09 commit 9f38ef6

File tree

6 files changed

+288
-152
lines changed

6 files changed

+288
-152
lines changed

examples/try_bencode_to_json.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ use bencode2json::try_bencode_to_json;
88
fn main() {
99
let result = try_bencode_to_json(b"d4:spam4:eggse").unwrap();
1010

11-
assert_eq!(result, r#"{"spam":"eggs"}"#);
11+
assert_eq!(
12+
result,
13+
r#"{"<string>spam</string>":"<string>eggs</string>"}"#
14+
);
1215
}

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//!
2323
//! let result = try_bencode_to_json(b"d4:spam4:eggse").unwrap();
2424
//!
25-
//! assert_eq!(result, r#"{"spam":"eggs"}"#);
25+
//! assert_eq!(result, r#"{"<string>spam</string>":"<string>eggs</string>"}"#);
2626
//! ```
2727
//!
2828
//! The primary goal of this lib is to provide a simple and easy-to-use API for
@@ -73,7 +73,10 @@ mod tests {
7373
fn when_it_succeeds() {
7474
let result = try_bencode_to_json(b"d4:spam4:eggse").unwrap();
7575

76-
assert_eq!(result, r#"{"spam":"eggs"}"#);
76+
assert_eq!(
77+
result,
78+
r#"{"<string>spam</string>":"<string>eggs</string>"}"#
79+
);
7780
}
7881

7982
#[test]

0 commit comments

Comments
 (0)