Skip to content

Commit

Permalink
Test assertion string.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grant Wuerker committed Sep 12, 2023
1 parent 0b0172a commit 90f749b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/codegen/src/yul/isel/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ pub fn lower_test(db: &dyn CodegenDb, test: FunctionId) -> yul::Object {
let test = db.mir_lowered_func_signature(test);
context.function_dependency.insert(test);

let dep_constants = context.resolve_constant_dependency(db);
let dep_functions: Vec<_> = context
.resolve_function_dependency(db)
.into_iter()
.map(yul::Statement::FunctionDefinition)
.collect();
let dep_constants = context.resolve_constant_dependency(db);
let dep_contracts = context.resolve_contract_dependency(db);
let runtime_funcs: Vec<_> = context
.runtime
Expand Down
4 changes: 4 additions & 0 deletions crates/tests/fixtures/files/assert_with_string.fe
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#test
fn foo() {
assert true, "oops"
}
12 changes: 12 additions & 0 deletions newsfragments/926.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Yul codegen was failing to include string literals used in test assertions. This resulted in a compiler error.

Example:

```
#test
fn foo() {
assert false, "oops"
}
```

The example code above was failing to compile, but now it compiles and executes as expected.

0 comments on commit 90f749b

Please sign in to comment.