Comments (2)
Irrespective of fmt
involvement in tests, it's also referenced in a realm within the how-to guide. We can replace this specific usage with ufmt
in the meantime until a more long-term solution is provided that addresses what you've touched on, etc. @thehowl
from gno.
imo better to explain it. There is a "test context" and a normal "execution context", and there will likely continue to be.
You can find a list of all of the "extra packages" and their functions here:
Lines 103 to 114 in b2046c5
The functions, variables and types they expose are below in the switch statement. Note that not all of the package names in the switch cases are available in test contexts; only the ones in the if statement.
Why is that?
Essentially, it's all a bit screwed, we have the directory gnovm/tests/files
which works with the semantics of filetests, except it doesn't and it actually has some more superpowers. It has a bunch of stdlibs registered using "gonative", a system to run Go code in Gno (similar to native bindings) which is very problematic for a variety of reasons. fmt
is currently implemented that way, and gonative
is essentially the reason why fmt.Println(struct{a string}{"x"})
fails.
These work together with the "testing stdlibs", available here: https://github.com/gnolang/gno/tree/master/gnovm/tests/stdlibs -- currently it only covers a few functions in std
.
The long term plan (2-3 months down the line, at least): have fmt use reflection, and not be "special" to test contests, together with other useful "test-specific" packages (crypto/md5 and sha1 maybe, encoding/binary, encoding/json, encoding/xml, math/big, math/rand).
We will continue having test-specific functions in std
, and likely introduce debug
which is also test-specific; so they have to be documented anyway. I suggest making a list of the functions that are currently exported in tests through gonative, and listing them referencing just the Go documentation directly, saying that most of them will eventually be ported over to Gno and be available for docs with gno doc
.
Test specific stdlibs will also be available in gno doc
eventually :)
from gno.
Related Issues (20)
- [Discussion/Request] Add a way to catch emitted events in `gno test`
- `Time.Now()` always return initial UNIX time HOT 2
- [gnokey] Make `gnokey query` more convenient HOT 1
- main README should disambiguate with gnosis project
- Oracle VRF HOT 2
- out of gas error is unclear `(VM call panic {WritePerByte})` HOT 1
- Incompatibility of `gnoland secrets init` with Read-Only mounted k8s Secrets
- [GnoVM] `TestSetRealm` not working properly in `gno test`
- contribs/gnokeykc has only tm2 features (missing thinkgs like maketx addpkg)
- RFC(gnovm): make all gno unit tests independent (and parallel)
- Validators cannot discover P2P peers when running as `StatefulSet` in k8s HOT 4
- [gnoland] Add `namespace` RPC endpoint HOT 2
- bug(gnovm): incorrect type comparison HOT 3
- Add/append balances and txs when genesis exists
- [docs] Update outdated images & gifs
- CI issue about contribs/ is only triggered after PR merges HOT 1
- Is it possible to have a dedicated CI error when it's just Codecov?
- Bug recently introduced makes `gno-js`'s `provider.evaluateExpression` timeout HOT 2
- Clarify allowed files and extensions when adding a package
- gnoclient does not show the full HTTP response in case of error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gno.