mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-14 05:11:07 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8cde6fa17 |
@@ -8,7 +8,7 @@ clippy:
|
|||||||
|
|
||||||
machete:
|
machete:
|
||||||
cargo install cargo-machete
|
cargo install cargo-machete
|
||||||
cargo machete crates
|
cargo machete
|
||||||
|
|
||||||
test: format clippy machete
|
test: format clippy machete
|
||||||
cargo test --workspace -- --nocapture
|
cargo test --workspace -- --nocapture
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ impl Metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn try_from_solidity(path: &Path) -> Option<Self> {
|
fn try_from_solidity(path: &Path) -> Option<Self> {
|
||||||
let spec = read_to_string(path)
|
let buf = 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,24 +147,18 @@ impl Metadata {
|
|||||||
buf
|
buf
|
||||||
});
|
});
|
||||||
|
|
||||||
if spec.is_empty() {
|
if buf.is_empty() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
match serde_json::from_str::<Self>(&spec) {
|
match serde_json::from_str::<Self>(&buf) {
|
||||||
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}' from data: {spec}",
|
"parsing Solidity test metadata file '{}' error: {error}",
|
||||||
path.display()
|
path.display()
|
||||||
);
|
);
|
||||||
None
|
None
|
||||||
|
|||||||
Reference in New Issue
Block a user