Skip to content

Commit fc10678

Browse files
RUST-1906 Remove human readable options (#531)
1 parent 806d68f commit fc10678

File tree

10 files changed

+46
-536
lines changed

10 files changed

+46
-536
lines changed

serde-tests/options.rs

Lines changed: 0 additions & 218 deletions
This file was deleted.

serde-tests/test.rs

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![allow(clippy::vec_init_then_push)]
33

44
mod json;
5-
mod options;
65

76
use pretty_assertions::assert_eq;
87
use serde::{
@@ -19,7 +18,6 @@ use std::{
1918
};
2019

2120
use bson::{
22-
bson,
2321
doc,
2422
oid::ObjectId,
2523
spec::BinarySubtype,
@@ -28,7 +26,6 @@ use bson::{
2826
DateTime,
2927
Decimal128,
3028
Deserializer,
31-
DeserializerOptions,
3229
Document,
3330
JavaScriptCodeWithScope,
3431
RawArray,
@@ -43,7 +40,6 @@ use bson::{
4340
RawJavaScriptCodeWithScopeRef,
4441
RawRegexRef,
4542
Regex,
46-
SerializerOptions,
4743
Timestamp,
4844
Uuid,
4945
};
@@ -86,25 +82,6 @@ where
8682
description
8783
);
8884

89-
let non_human_readable_doc = bson::to_document_with_options(
90-
&expected_value,
91-
#[allow(deprecated)]
92-
SerializerOptions::builder().human_readable(false).build(),
93-
)
94-
.expect(description);
95-
assert_eq!(&non_human_readable_doc, expected_doc, "{}", description);
96-
assert_eq!(
97-
expected_value,
98-
&bson::from_document_with_options::<T>(
99-
non_human_readable_doc,
100-
#[allow(deprecated)]
101-
DeserializerOptions::builder().human_readable(false).build()
102-
)
103-
.expect(description),
104-
"{}",
105-
description
106-
);
107-
10885
assert_eq!(
10986
&bson::from_reader::<_, T>(expected_bytes.as_slice()).expect(description),
11087
expected_value,
@@ -1353,62 +1330,6 @@ fn hint_cleared() {
13531330
assert_eq!(round_doc, doc! { "doc": doc_value, "binary": binary_value });
13541331
}
13551332

1356-
#[test]
1357-
fn non_human_readable() {
1358-
let bytes = vec![1, 2, 3, 4];
1359-
let binary = RawBinaryRef {
1360-
bytes: &bytes,
1361-
subtype: BinarySubtype::BinaryOld,
1362-
};
1363-
1364-
let doc_bytes = bson::to_vec(&doc! { "a": "b", "array": [1, 2, 3] }).unwrap();
1365-
let doc = RawDocument::from_bytes(doc_bytes.as_slice()).unwrap();
1366-
let arr = doc.get_array("array").unwrap();
1367-
let oid = ObjectId::new();
1368-
let uuid = Uuid::new();
1369-
1370-
#[derive(Debug, Deserialize, Serialize)]
1371-
struct Foo<'a> {
1372-
#[serde(borrow)]
1373-
binary: RawBinaryRef<'a>,
1374-
#[serde(borrow)]
1375-
doc: &'a RawDocument,
1376-
#[serde(borrow)]
1377-
arr: &'a RawArray,
1378-
oid: ObjectId,
1379-
uuid: Uuid,
1380-
}
1381-
1382-
let val = Foo {
1383-
binary,
1384-
doc,
1385-
arr,
1386-
oid,
1387-
uuid,
1388-
};
1389-
1390-
let human_readable = bson::to_bson(&val).unwrap();
1391-
let non_human_readable = bson::to_bson_with_options(
1392-
&val,
1393-
#[allow(deprecated)]
1394-
SerializerOptions::builder().human_readable(false).build(),
1395-
)
1396-
.unwrap();
1397-
1398-
let expected = bson!({
1399-
"binary": Binary { bytes: bytes.clone(), subtype: BinarySubtype::BinaryOld },
1400-
"doc": {
1401-
"a": "b",
1402-
"array": [1, 2, 3],
1403-
},
1404-
"arr": [1, 2, 3],
1405-
"oid": oid,
1406-
"uuid": uuid
1407-
});
1408-
assert_eq!(human_readable, expected);
1409-
assert_eq!(human_readable, non_human_readable);
1410-
}
1411-
14121333
#[test]
14131334
fn invalid_length() {
14141335
// This is a regression test for fuzzer-generated input (RUST-1240).

0 commit comments

Comments
 (0)