mirror of
https://github.com/serde-rs/json.git
synced 2025-10-02 07:21:29 +00:00

The following changes are included: - Delete per-file license notices at the top of each file. - Delete the first paragraph of LICENSE-MIT (an inaccurate pseudo-copyright line), leaving only the text of the MIT license. Nothing about the license of Serde code has changed, only our understanding of how to correctly communicate the license has changed. This mirrors an equivalent change being applied in the rust-lang/rust repository.
19 lines
487 B
Rust
19 lines
487 B
Rust
extern crate serde_json;
|
|
|
|
use serde_json::{from_str, Value};
|
|
|
|
#[test]
|
|
fn test_map_order() {
|
|
// Sorted order
|
|
#[cfg(not(feature = "preserve_order"))]
|
|
const EXPECTED: &[&str] = &["a", "b", "c"];
|
|
|
|
// Insertion order
|
|
#[cfg(feature = "preserve_order")]
|
|
const EXPECTED: &[&str] = &["b", "a", "c"];
|
|
|
|
let v: Value = from_str(r#"{"b":null,"a":null,"c":null}"#).unwrap();
|
|
let keys: Vec<_> = v.as_object().unwrap().keys().collect();
|
|
assert_eq!(keys, EXPECTED);
|
|
}
|