-
Notifications
You must be signed in to change notification settings - Fork 375
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
proposal: removing filetests for end-users #1346
Labels
Comments
thehowl
added
📦 🤖 gnovm
Issues or PRs gnovm related
gno-proposal
Gnolang change proposals
labels
Nov 9, 2023
My opinion:
|
From the retreat AtticWG:
|
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Opinionated take stemming from discussion on #891.
I propose to remove filetests as a tool for testing Gno realms in favour of more flexible programmatic approaches to verify Gno programs. I still think their functionality can be kept internally for the
gnovm/tests/files
directory, as we have an ever-expanding set of tests that verify core functionality of the GnoVM that would otherwise be difficult to test; however, for end-users, I don't see much benefits compared to using "normal" testing features.I'll go through the directives and explain briefly by what I think they could be replaced:
// PKGPATH:
--TestSetOrigCaller
orTestSetPrevRealm
// MAXALLOC:
-- a potentialdebug
(Add "debug" stdlib #1266) function (so no-op onchain), with signaturefunc WithAllocationLimit(n int64, f func())
// SEND:
--TestSetOrigSend
// Output:
-- instead of working with usingprintln
and similar, which are not available on-chain anyway, this can work by simply changing the test functions to return values instead and verify their output.// Error:
--defer func() { err := recover(); /* verify value of err... */ }()
// Realm:
-- none: how we represent realm objects should be internal information which we can change from one release to the next, used for testing realm storage but useless for end users.So we're removing duplicate ways to do thing, while creating a testing system which does not require learning about a new one when switching from Go to Gno (except for a few functions to manipulate the tests, like the TestSet functions).
Additionally, by making sure that all of the functionality of filetests can be done in normal tests, we remove the necessity of creating one file per test (which can easily pollute a package's directory) and allow for flexibility in testing out a lot of different parameters (ie. having a table-test for checking many different OrigCallers).
The text was updated successfully, but these errors were encountered: