Compare commits

...

1 Commits

Author SHA1 Message Date
xermicus 5c31fdb236 fix the simple test case definition
Signed-off-by: xermicus <cyrill@parity.io>
2025-06-17 12:20:14 +02:00
+10 -4
View File
@@ -132,7 +132,7 @@ impl Metadata {
} }
fn try_from_solidity(path: &Path) -> Option<Self> { fn try_from_solidity(path: &Path) -> Option<Self> {
let buf = read_to_string(path) let spec = read_to_string(path)
.inspect_err(|error| { .inspect_err(|error| {
log::error!( log::error!(
"opening JSON test metadata file '{}' error: {error}", "opening JSON test metadata file '{}' error: {error}",
@@ -147,18 +147,24 @@ impl Metadata {
buf buf
}); });
if buf.is_empty() { if spec.is_empty() {
return None; return None;
} }
match serde_json::from_str::<Self>(&buf) { match serde_json::from_str::<Self>(&spec) {
Ok(mut metadata) => { Ok(mut metadata) => {
metadata.file_path = Some(path.to_path_buf()); metadata.file_path = Some(path.to_path_buf());
let name = path
.file_name()
.expect("this should be the path to a Solidity file")
.to_str()
.expect("the file name should be valid UTF-8k");
metadata.contracts = Some([(String::from("Test"), format!("{name}:Test"))].into());
Some(metadata) Some(metadata)
} }
Err(error) => { Err(error) => {
log::error!( log::error!(
"parsing Solidity test metadata file '{}' error: {error}", "parsing Solidity test metadata file '{}' error: '{error}' from data: {spec}",
path.display() path.display()
); );
None None