Skip to content

Commit

Permalink
tests: add IR tests with and without constant folding.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Aug 19, 2024
1 parent c979c90 commit 5066415
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/compiler/ir/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ fn ir() {

files.into_iter().for_each(|path| {
let mut mint = goldenfile::Mint::new(".");
// Path to the .ir file, replace the .in extension with .ir.
let output_path = path.with_extension("ir");

let output_path = if cfg!(feature = "constant-folding") {
path.with_extension("folding.ir")
} else {
path.with_extension("no-folding.ir")
};

let output_file = mint.new_goldenfile(output_path).unwrap();

println!("file: {:?}", path);
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions lib/src/compiler/ir/tests/testdata/1.no-folding.ir
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AND
EQ
FIELD_ACCESS
IDENT Symbol { type_value: struct, kind: Field(0, true) }
IDENT Symbol { type_value: integer(unknown), kind: Field(1, false) }
CONST integer(0)
CONST boolean(true)

0 comments on commit 5066415

Please sign in to comment.