Update report to use better map data structures

This commit is contained in:
Omar Abdulla
2025-08-24 23:01:30 +03:00
parent 38e3915169
commit 4f55e8968d
5 changed files with 16 additions and 11 deletions
+1
View File
@@ -15,6 +15,7 @@ revive-dt-compiler = { workspace = true }
anyhow = { workspace = true }
paste = { workspace = true }
indexmap = { workspace = true, features = ["serde"] }
semver = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
+5 -4
View File
@@ -2,12 +2,13 @@
//! reporters and combines them into a single unified report.
use std::{
collections::{BTreeSet, HashMap, HashSet},
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
fs::OpenOptions,
time::{SystemTime, UNIX_EPOCH},
};
use anyhow::Result;
use indexmap::IndexMap;
use revive_dt_compiler::Mode;
use revive_dt_config::Arguments;
use revive_dt_format::{case::CaseIdx, corpus::Corpus};
@@ -157,9 +158,9 @@ pub struct Report {
/// The list of metadata files that were found by the tool.
pub metadata_files: BTreeSet<MetadataFilePath>,
/// Information relating to each test case.
#[serde_as(as = "HashMap<_, HashMap<DisplayFromStr, HashMap<DisplayFromStr, _>>>")]
#[serde_as(as = "BTreeMap<_, HashMap<DisplayFromStr, BTreeMap<DisplayFromStr, _>>>")]
pub test_case_information:
HashMap<MetadataFilePath, HashMap<Mode, HashMap<CaseIdx, TestCaseReport>>>,
BTreeMap<MetadataFilePath, HashMap<Mode, BTreeMap<CaseIdx, TestCaseReport>>>,
}
impl Report {
@@ -188,5 +189,5 @@ pub struct TestCaseIgnoreInformation {
pub reason: String,
/// Additional fields that describe more information on why the test case is ignored.
#[serde(flatten)]
pub additional_fields: HashMap<String, serde_json::Value>,
pub additional_fields: IndexMap<String, serde_json::Value>,
}
+3 -2
View File
@@ -1,8 +1,9 @@
//! The types associated with the events sent by the runner to the reporter.
#![allow(dead_code)]
use std::{collections::HashMap, sync::Arc};
use std::sync::Arc;
use indexmap::IndexMap;
use revive_dt_format::corpus::Corpus;
use revive_dt_format::metadata::Metadata;
use tokio::sync::{broadcast, oneshot};
@@ -264,7 +265,7 @@ define_event! {
/// A reason for the test to be ignored.
reason: String,
/// Additional fields that describe more information on why the test was ignored.
additional_fields: HashMap<String, serde_json::Value>
additional_fields: IndexMap<String, serde_json::Value>
},
}
}