-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GnoVM] Add Event support when testing or running expressions #2007
Comments
before doing this, we need to address #2028 |
How does it look? ( single line of printing $ go run ./gnovm/cmd/gno test -root-dir ~/gno -v=true ./examples/gno.land/r/demo/event
=== RUN TestFuncs
{"pkg_path":"gno.land/r/demo/event2","type":"t","func":"inner","attrs":[{"key":"k","value":"v"}]}
{"pkg_path":"gno.land/r/demo/event2","type":"t","func":"Hello","attrs":[{"key":"k","value":"v"}]}
{"pkg_path":"gno.land/r/demo/event","type":"t","func":"inner","attrs":[{"key":"k","value":"v"}]}
{"pkg_path":"gno.land/r/demo/event","type":"t","func":"Hello","attrs":[{"key":"k","value":"v"}]}
{"pkg_path":"gno.land/r/demo/event","type":"other","func":"Other","attrs":[{"key":"k","value":"v"}]}
--- PASS: TestFuncs (0.00s)
ok ./examples/gno.land/r/demo/event 0.76s |
Hey, thanks for this - I'm just wondering if events would clutter up the
I think option 1 could be good, but I'd like to hear more opinions. |
Since And for option 2, yes I do agree its more complicated than option 1 but any other ideas?? @notJoon |
Yes I agree with this. Because it describes the printing runtime metrics outputs like gas or memory, I think there seems to be room for cofusion when events are involved in that flag. Lines 155 to 160 in 0fc011a
Also, there may be cases where someone only want to output events (e.g. testing purpose), so it seems be better to have assign separate event flag to follow for flexible selection. In this case, I prefer the Of course, I also agree this change might get a bit more complicated, but there is more to gain than lose. |
…ests (#2975) - [x] add `gno test -print-events` flag for unit tests. Props to @r3v4s for his work on #2071 - [x] add `// Events:` support in `_filetests.gno`. - [x] cleanup `gno.Machine` between unit tests (\o/) . Fixes #1982 Closes #2071 Addresses #2007 --------- Signed-off-by: moul <94029+moul@users.noreply.github.com>
Description
With #1653 merged, we should now start working on expanding the feature set. It would be great if
gno test
&gno run
would display events emitted when executing functions that have them, for example with a-events
flag in order to not clog up the CLI.EDIT: another consideration is to be able to catch events within Gno test files and assert their names & arguments.
The text was updated successfully, but these errors were encountered: