File: test_regression.rs

package info (click to toggle)
rust-serde-qs 0.13.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 344 kB
  • sloc: makefile: 2; sh: 1
file content (21 lines) | stat: -rw-r--r-- 495 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_qs as qs;

#[test]
fn double_encoding_keys() {
    #[derive(Debug, Serialize, Deserialize, PartialEq)]
    struct Human {
        #[serde(rename = "full name")]
        name: String,
    }

    let human = Human {
        name: "John Doe".to_string(),
    };

    let encoded = serde_qs::to_string(&human).unwrap();
    print!("{}", encoded);
    assert_eq!(serde_qs::from_str::<Human>(&encoded).unwrap(), human);
}