-
Notifications
You must be signed in to change notification settings - Fork 449
Open
Labels
📦 🤖 gnovmIssues or PRs gnovm relatedIssues or PRs gnovm related
Milestone
Description
Description
Check this out:
package panic
var count int
func Increment(shouldRevert bool) {
count++
if shouldRevert {
count++
panic("i was instructed to revert!")
}
}package panic
import "testing"
func TestIncrement(t *testing.T) {
println(count)
Increment(true)
}
func TestIncrement2(t *testing.T) {
println(count)
}Running gno test will output the following:
❯ gno test . -v
--- WARNING: unable to read package path from gno.mod or gno root directory; try creating a gno.mod file
=== RUN TestIncrement
0
panic: i was instructed to revert!
--- FAIL: TestIncrement (0.00s)
=== RUN TestIncrement2
2
--- PASS: TestIncrement2 (0.00s)
.: test pkg: failed: "TestIncrement"
FAIL
FAIL . 0.69s
FAIL
FAIL
FAIL: 0 build errors, 1 test errorsIssue number one is this, where the machine state & context is not reset between tests, and the second problem is, as demonstrated with this issue, the fact that a panic statement does not revert the state.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
📦 🤖 gnovmIssues or PRs gnovm relatedIssues or PRs gnovm related
Type
Projects
Status
Other dev assigned
Status
Backlog