Skip to content

Commit

Permalink
fixup test, add iterator for decorators in a node
Browse files Browse the repository at this point in the history
  • Loading branch information
paracetamolo committed Dec 16, 2024
1 parent 744e465 commit bff4676
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions core/src/mast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ impl MastForest {
&self.nodes
}

pub fn decorators(&self) -> &[Decorator] {
&self.decorators
}

pub fn advice_map(&self) -> &AdviceMap {
&self.advice_map
}
Expand Down
12 changes: 6 additions & 6 deletions miden/tests/integration/cli/cli_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ fn cli_run() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

use assembly::{mast::MastNode, Library};
use assembly::Library;
use vm_core::Decorator;

#[test]
fn cli_bundle_debug() {
Expand All @@ -52,11 +53,10 @@ fn cli_bundle_debug() {
cmd.assert().success();

let lib = Library::deserialize_from_file("./tests/integration/cli/data/out.masl").unwrap();
let found_one_decorator = lib.mast_forest().nodes().iter().any(|node| match node {
MastNode::Block(node) => !node.decorators().is_empty(),
_ => false,
});
assert!(found_one_decorator);
// If there are any AsmOp decorators in the forest, the bundle is in debug mode.
let found_one_asm_op =
lib.mast_forest().decorators().iter().any(|d| matches!(d, Decorator::AsmOp(_)));
assert!(found_one_asm_op);
fs::remove_file("./tests/integration/cli/data/out.masl").unwrap();
}

Expand Down

0 comments on commit bff4676

Please sign in to comment.