Skip to content

Commit

Permalink
variable coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
plotchy committed Jul 22, 2024
1 parent d200403 commit 88d6a95
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/pyrometer/tests/no_killed_ctxs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,11 @@ fn test_repros() {
assert_no_parse_errors(path_str);
}
}

#[test]
fn test_variable() {
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let path_str = format!("{manifest_dir}/tests/test_data/variable.sol");
let sol = include_str!("./test_data/variable.sol");
assert_no_ctx_killed(path_str, sol);
}
44 changes: 44 additions & 0 deletions crates/pyrometer/tests/test_data/variable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
contract Variable {
aUserType a_user_type;

struct aUserType {
uint aUserType;
}

function a_user_type_memory(aUserType memory a_user_type) public returns (uint) {
return a_user_type.aUserType;
}

function a_user_type_calldata(aUserType calldata a_user_type) public returns (uint) {
return a_user_type.aUserType;
}

function a_user_type_storage() public returns (uint) {
aUserType storage a_user_type = a_user_type;
return a_user_type.aUserType;
}
}

contract B {
struct A {
address a;
}
}
contract A is B {
A a; // contract A

function return_struct() external returns (A memory) {
// a is of type B.A, *not* Contract::A
a = A(address(this));
return a;
}
}

contract C {
C c;
function return_contract() external returns (C) {
// c is of type Contract::C
c = C(address(this));
return c;
}
}

0 comments on commit 88d6a95

Please sign in to comment.