mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-08-02 12:14:47 +02:00
updates
This commit is contained in:
parent
e19eb4601e
commit
97ee910d85
36 changed files with 716 additions and 762 deletions
|
|
@ -216,16 +216,18 @@ struct GameList {
|
|||
#[test_case("tests/data/maparray.vdf")]
|
||||
#[test_case("tests/errors/invalidmaparraykeys.vdf")]
|
||||
fn test_serde(path: &str) {
|
||||
let raw = read_to_string(path).unwrap();
|
||||
match from_str::<Expected>(&raw) {
|
||||
Ok(result) => insta::assert_ron_snapshot!(path, result),
|
||||
Err(e) => {
|
||||
let handler = GraphicalReportHandler::new_themed(GraphicalTheme::unicode_nocolor());
|
||||
let mut out = String::new();
|
||||
handler.render_report(&mut out, &e).unwrap();
|
||||
insta::assert_snapshot!(path, out)
|
||||
insta::with_settings!({sort_maps => true}, {
|
||||
let raw = read_to_string(path).unwrap();
|
||||
match from_str::<Expected>(&raw) {
|
||||
Ok(result) => insta::assert_json_snapshot!(path, result),
|
||||
Err(e) => {
|
||||
let handler = GraphicalReportHandler::new_themed(GraphicalTheme::unicode_nocolor());
|
||||
let mut out = String::new();
|
||||
handler.render_report(&mut out, &e).unwrap();
|
||||
insta::assert_snapshot!(format!("serde__{}", path), out)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[test_case("tests/data/toplevel.vdf")]
|
||||
|
|
@ -234,18 +236,20 @@ fn test_serde(path: &str) {
|
|||
#[test_case("tests/data/serde_array_type.vdf")]
|
||||
#[test_case("tests/data/maparray.vdf")]
|
||||
fn test_serde_table(path: &str) {
|
||||
let raw = read_to_string(path).unwrap();
|
||||
match from_str::<Table>(&raw) {
|
||||
Ok(result) => {
|
||||
insta::assert_ron_snapshot!(format!("table__{}", path), result);
|
||||
insta::with_settings!({sort_maps => true}, {
|
||||
let raw = read_to_string(path).unwrap();
|
||||
match from_str::<Table>(&raw) {
|
||||
Ok(result) => {
|
||||
insta::assert_json_snapshot!(format!("table__{}", path), result);
|
||||
}
|
||||
Err(e) => {
|
||||
let handler = GraphicalReportHandler::new_themed(GraphicalTheme::unicode_nocolor());
|
||||
let mut out = String::new();
|
||||
handler.render_report(&mut out, &e).unwrap();
|
||||
insta::assert_snapshot!(format!("table__{}", path), out)
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let handler = GraphicalReportHandler::new_themed(GraphicalTheme::unicode_nocolor());
|
||||
let mut out = String::new();
|
||||
handler.render_report(&mut out, &e).unwrap();
|
||||
insta::assert_snapshot!(format!("table__{}", path), out)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[test_case("tests/data/concrete.vmt")]
|
||||
|
|
@ -258,5 +262,8 @@ fn test_serde_from_table(path: &str) {
|
|||
let result = Table::load_from_str(&raw).unwrap();
|
||||
|
||||
let material: Expected = from_entry(result.into()).expect("table to material");
|
||||
insta::assert_ron_snapshot!(format!("table_to_material__{}", path), material);
|
||||
|
||||
insta::with_settings!({sort_maps => true}, {
|
||||
insta::assert_json_snapshot!(format!("table_to_material__{}", path), material);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue