Skip to content

Commit

Permalink
Improve error message on assertion when rules fail to parse
Browse files Browse the repository at this point in the history
  • Loading branch information
ggiraldez committed Jul 12, 2024
1 parent e5228dc commit b55de79
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
22 changes: 22 additions & 0 deletions crates/solidity/outputs/cargo/tests/src/binding_rules.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use std::path::PathBuf;

use metaslang_graph_builder::ast::File;
use slang_solidity::bindings;
use slang_solidity::cst::KindTypes;

#[test]
fn test_binding_rules_parse_successfully() {
let binding_rules = bindings::get_binding_rules();
let graph_builder = File::<KindTypes>::from_str(binding_rules);

assert!(
graph_builder.is_ok(),
"Parsing binding rules failed:\n{}",
graph_builder
.err()
.map(|err| err
.display_pretty(&PathBuf::from("rules.msgb"), binding_rules)
.to_string())
.unwrap_or_default()
);
}
10 changes: 0 additions & 10 deletions crates/solidity/outputs/cargo/tests/src/bindings_rules.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/solidity/outputs/cargo/tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg(test)]

mod binding_imports;
mod binding_rules;
mod bindings_assertions;
mod bindings_imports;
mod bindings_output;
mod bindings_rules;
mod cst_output;
mod doc_examples;
mod trivia;

0 comments on commit b55de79

Please sign in to comment.