-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snapshot tests for module level events
- Loading branch information
Showing
8 changed files
with
448 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
crates/analyzer/tests/snapshots/analysis__module_level_events.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
--- | ||
source: crates/analyzer/tests/analysis.rs | ||
expression: "build_snapshot(&files, module_id, &db)" | ||
|
||
--- | ||
note: | ||
┌─ features/module_level_events.fe:2:5 | ||
│ | ||
2 │ idx sum: u256 | ||
│ ^^^^^^^^^^^^^ u256 | ||
|
||
note: | ||
┌─ features/module_level_events.fe:4:5 | ||
│ | ||
4 │ ╭ pub fn add(a: u256, b: u256) -> u256: | ||
5 │ │ let sum: u256 = a + b | ||
6 │ │ emit Added(sum=sum) | ||
7 │ │ return a + b | ||
│ ╰────────────────────^ attributes hash: 10094331793610550579 | ||
│ | ||
= FunctionSignature { | ||
self_decl: None, | ||
params: [ | ||
FunctionParam { | ||
name: "a", | ||
typ: Ok( | ||
Base( | ||
Numeric( | ||
U256, | ||
), | ||
), | ||
), | ||
}, | ||
FunctionParam { | ||
name: "b", | ||
typ: Ok( | ||
Base( | ||
Numeric( | ||
U256, | ||
), | ||
), | ||
), | ||
}, | ||
], | ||
return_type: Ok( | ||
Base( | ||
Numeric( | ||
U256, | ||
), | ||
), | ||
), | ||
} | ||
|
||
note: | ||
┌─ features/module_level_events.fe:5:18 | ||
│ | ||
5 │ let sum: u256 = a + b | ||
│ ^^^^ u256 | ||
|
||
note: | ||
┌─ features/module_level_events.fe:5:25 | ||
│ | ||
5 │ let sum: u256 = a + b | ||
│ ^ ^ u256: Value | ||
│ │ | ||
│ u256: Value | ||
|
||
note: | ||
┌─ features/module_level_events.fe:5:25 | ||
│ | ||
5 │ let sum: u256 = a + b | ||
│ ^^^^^ u256: Value | ||
6 │ emit Added(sum=sum) | ||
│ ^^^ u256: Value | ||
7 │ return a + b | ||
│ ^ ^ u256: Value | ||
│ │ | ||
│ u256: Value | ||
|
||
note: | ||
┌─ features/module_level_events.fe:7:16 | ||
│ | ||
7 │ return a + b | ||
│ ^^^^^ u256: Value | ||
|
||
note: | ||
┌─ features/module_level_events.fe:6:9 | ||
│ | ||
6 │ emit Added(sum=sum) | ||
│ ^^^^^^^^^^^^^^^^^^^ attributes hash: 3277580564244611338 | ||
│ | ||
= Event { | ||
name: "Added", | ||
fields: [ | ||
EventField { | ||
name: "sum", | ||
typ: Ok( | ||
Base( | ||
Numeric( | ||
U256, | ||
), | ||
), | ||
), | ||
is_indexed: true, | ||
}, | ||
], | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/lowering/tests/snapshots/lowering__module_level_events.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
source: crates/lowering/tests/lowering.rs | ||
expression: lowered_code | ||
|
||
--- | ||
event Added: | ||
idx sum: u256 | ||
|
||
contract Adder: | ||
pub fn add(a: u256, b: u256) -> u256: | ||
let sum: u256 = a + b | ||
emit Added(sum=sum) | ||
return a + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.