Skip to content

Commit

Permalink
test(gnovm/pkg/gnolang): improve TestPrecompile (gnolang#1659)
Browse files Browse the repository at this point in the history
This test actually only tested the private `precompileAST()` function,
not the public `Precompile()` function.

The change makes it call the public function and adds some more cases
described in comments like:
- unknow-realm (no error)
- syntax error
- blacklist (was already done)
- multiple files (not possible, `Precompile()` is single file only)

Also used multiple-line string for file and expected content, for better
readability.

Relates to gnolang#1636

The test can be run with 
```
go test ./gnovm/pkg/gnolang/ -v -run Precompile
```

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [x] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
  • Loading branch information
tbruyelle authored and leohhhn committed Feb 29, 2024
1 parent 5e598d6 commit 25fb6de
Showing 1 changed file with 260 additions and 68 deletions.
328 changes: 260 additions & 68 deletions gnovm/pkg/gnolang/precompile_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 25fb6de

Please sign in to comment.