Skip to content

Commit ca5e9bf

Browse files
committed
Add a test to demonstrate usage of null in doc macro
1 parent 87dd4f8 commit ca5e9bf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/modules/macros.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ fn recursive_macro() {
1717
"apple" => "ripe"
1818
}
1919
],
20-
"e" => { "single" => "test" }
20+
"e" => { "single" => "test" },
21+
"n" => (Bson::Null)
2122
};
2223

2324
match doc.get("a") {
@@ -106,4 +107,11 @@ fn recursive_macro() {
106107
},
107108
_ => panic!("Single-item document was not inserted correctly."),
108109
}
110+
111+
match doc.get("n") {
112+
Some(&Bson::Null) => {
113+
// It was null
114+
}
115+
_ => panic!("Null was not inserted correctly."),
116+
}
109117
}

0 commit comments

Comments
 (0)