Files
uneval/test_fixtures/data.toml
T
2021-11-27 19:09:11 +07:00

77 lines
1.4 KiB
TOML

[simple]
types = "Simple"
definition = """
#[derive(PartialEq, Debug, Serialize)]
pub struct Simple {
pub integer: i32,
pub character: char,
pub float: f32,
pub string: String,
pub boolean: bool,
}
"""
value = """
definition::Simple {
integer: 123,
character: 'c',
float: std::f32::consts::PI,
string: "text string".into(),
boolean: false
}
"""
[nested]
types = "Nested,Inner"
definition = """
#[derive(PartialEq, Debug, Serialize)]
pub struct Nested {
pub inner: Inner,
}
#[derive(PartialEq, Debug, Serialize)]
pub struct Inner {
pub value: i32,
}
"""
value = """
definition::Nested {
inner: definition::Inner {
value: 123
}
}
"""
[complex]
types = "Complex"
definition = """
use std::collections::HashMap;
#[derive(PartialEq, Debug, Serialize)]
pub struct Complex {
pub tuple: (i32, f32, String),
pub vector: Vec<i32>,
pub map: HashMap<i128, String>,
}
"""
value = """
{
let mut map = std::collections::HashMap::new();
map.insert(0, "test".into());
map.insert(120, "test longer".into());
definition::Complex {
tuple: (1, 1.0, "tuple entry".into()),
vector: vec![1, 2, 3, 4, 5, -1, -2, -3, -4, -5],
map
}
}
"""
[floats]
types = "Floats"
definition = """
#[derive(PartialEq, Debug, Serialize)]
pub struct Floats(pub Vec<f32>);
"""
value = """
definition::Floats(vec![
123456789e30,
123456789e-30,
12345.6789
])
"""