Skip to content

Commit

Permalink
Adds correct filepath to test_precompile_test_vectors* panics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Jun 21, 2023
1 parent fba8457 commit dad00df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frame/evm/test-vector-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ impl PrecompileHandle for MockHandle {
/// The file is expected to be in JSON format and contain an array of test vectors, where each
/// vector can be deserialized into an "EthConsensusTest".
pub fn test_precompile_test_vectors<P: Precompile>(filepath: &str) -> Result<(), String> {
let data = fs::read_to_string(filepath).expect("Failed to read blake2F.json");
let data =
fs::read_to_string(filepath).unwrap_or_else(|_| panic!("Failed to read {}", filepath));

let tests: Vec<EthConsensusTest> = serde_json::from_str(&data).expect("expected json array");

Expand Down Expand Up @@ -163,7 +164,8 @@ pub fn test_precompile_test_vectors<P: Precompile>(filepath: &str) -> Result<(),
}

pub fn test_precompile_failure_test_vectors<P: Precompile>(filepath: &str) -> Result<(), String> {
let data = fs::read_to_string(filepath).expect("Failed to read json file");
let data =
fs::read_to_string(filepath).unwrap_or_else(|_| panic!("Failed to read {}", filepath));

let tests: Vec<EthConsensusFailureTest> =
serde_json::from_str(&data).expect("expected json array");
Expand Down

0 comments on commit dad00df

Please sign in to comment.