Skip to content

gno test Clarify and limit test file usage #4178

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

Open
moul opened this issue Apr 17, 2025 · 3 comments
Open

gno test Clarify and limit test file usage #4178

moul opened this issue Apr 17, 2025 · 3 comments

Comments

@moul
Copy link
Member

moul commented Apr 17, 2025

This proposal aims to simplify and clarify the structure and usage of test files in Gno.

Proposal (short-term goals):

  • Only allow _test.gno files to reside alongside .gno files in the same directory.
  • Support an optional testfiles/ or testdata/ directory. If present, it can contain _filetest.gno and .txtar files. Move _filetest.gno to filetests/* folder. #846
  • When executing _filetest.gno or .txtar files, display a warning indicating that these are internal testing tools, subject to change or removal, and recommend using _test.gno files for standard testing.

Long-term goals:

  • Deprecate _filetest.gno in favor of testable func Example() functions, similar to Go’s testing approach. proposal: testable markdown documentation #2245
  • Gradually phase out .txtar files as a public testing mechanism, retaining them as internal tools for advanced use cases.

Related:

  • #1346 – proposal: removing filetests for end-users
  • #1269 – improve txtar DX
  • #846 – Move _filetest.gno to filetests/* folder
  • #2245 – proposal: testable markdown documentation

cc @thehowl @gfanton

@paulogarithm
Copy link

Hi moul !

I had some questions about how you see the proposal:

Does the test fails when there is no _test.gno ? or does it just makes a warning and goes to the next test ? or does it fails everything ?

@moul
Copy link
Member Author

moul commented Apr 30, 2025

I like the idea of enforcing tests and marking packages without test files as failing in gno test. While some may choose to ignore running gno test, those who care will expect packages to include test files. To simplify this, we could allow empty test files, making it clear that users are bypassing the requirement while encouraging them to consider writing tests. This way, we can rely on coverage to elevate the process further.

@thehowl
Copy link
Member

thehowl commented May 13, 2025

We should check out joon's work on #2357 :)

Looks good to me, I don't know if we really want to support .txtar beyond what we currently support though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging a pull request may close this issue.

3 participants