-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gnovm): add 'gno test -print-events' + cleanup machine between t…
…ests Signed-off-by: moul <[email protected]>
- Loading branch information
Showing
4 changed files
with
146 additions
and
5 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
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,33 @@ | ||
# Test with a valid _filetest.gno file | ||
|
||
gno test -print-events . | ||
|
||
! stdout .+ | ||
stderr 'ok \. \d\.\d\ds' | ||
|
||
gno test -print-events -v . | ||
|
||
! stdout .+ | ||
stderr '=== RUN file/valid_filetest.gno' | ||
stderr '--- PASS: file/valid_filetest.gno \(\d\.\d\ds\)' | ||
stderr 'ok \. \d\.\d\ds' | ||
|
||
-- valid.gno -- | ||
package valid | ||
|
||
-- valid_filetest.gno -- | ||
package main | ||
|
||
import "std" | ||
|
||
func main() { | ||
println("test") | ||
std.Emit("EventA") | ||
std.Emit("EventB", "keyA", "valA") | ||
} | ||
|
||
// Output: | ||
// test | ||
|
||
// Events: | ||
// [{"type":"EventA","attrs":[],"pkg_path":"","func":"main"},{"type":"EventB","attrs":[{"key":"keyA","value":"valA"}],"pkg_path":"","func":"main"}] |
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,26 @@ | ||
# Test with a valid _test.gno file | ||
|
||
gno test -print-events . | ||
|
||
! stdout .+ | ||
stderr 'EVENTS: \[{\"type\":\"EventA\",\"attrs\":\[\],\"pkg_path\":\"gno.land/r/.*\",\"func\":\"TestA\"}\]' | ||
stderr 'EVENTS: \[{\"type\":\"EventB\",\"attrs\":\[{\"key\":\"keyA\",\"value\":\"valA\"}\],\"pkg_path\":\"gno.land/r/.*\",\"func\":\"TestB\"},{\"type\":\"EventC\",\"attrs\":\[{\"key\":\"keyD\",\"value\":\"valD\"}\],\"pkg_path\":\"gno.land/r/.*\",\"func\":\"TestB\"}\]' | ||
stderr 'ok \. \d\.\d\ds' | ||
|
||
-- valid.gno -- | ||
package valid | ||
|
||
-- valid_test.gno -- | ||
package valid | ||
|
||
import "testing" | ||
import "std" | ||
|
||
func TestA(t *testing.T) { | ||
std.Emit("EventA") | ||
} | ||
|
||
func TestB(t *testing.T) { | ||
std.Emit("EventB", "keyA", "valA") | ||
std.Emit("EventC", "keyD", "valD") | ||
} |
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