1
use ron::{
2
    ser::{to_string_pretty, PrettyConfig},
3
    to_string,
4
};
5
use serde::{Deserialize, Serialize};
6

            
7
#[derive(Debug, PartialEq, Deserialize, Serialize)]
8
struct Point {
9
    x: f64,
10
    y: f64,
11
}
12

            
13
#[test]
14
4
fn test_struct_names() {
15
4
    let value = Point { x: 1.0, y: 2.0 };
16
4
    let struct_name = to_string_pretty(&value, PrettyConfig::default().struct_names(true));
17
4
    assert_eq!(
18
4
        struct_name,
19
4
        Ok("Point(\n    x: 1.0,\n    y: 2.0,\n)".to_string())
20
4
    );
21
4
    let no_struct_name = to_string(&value);
22
4
    assert_eq!(no_struct_name, Ok("(x:1.0,y:2.0)".to_string()));
23
4
}