Skip to content

Filetests stop after panic when using nil function argument #4220

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
jeronimoalbi opened this issue Apr 26, 2025 · 1 comment
Open

Filetests stop after panic when using nil function argument #4220

jeronimoalbi opened this issue Apr 26, 2025 · 1 comment
Labels
🐞 bug Something isn't working

Comments

@jeronimoalbi
Copy link
Member

Filetest breaks when using nil function argument

Description

Filetest break when a public realm function that has a pointer argument receives a nil value and then panics.

This would be a common case when checking that a pointer argument is not nil, normally one would expect public realm functions to panic in such cases.

Your environment

  • Go version (example: go1.24.1)
  • OS and CPU architecture (example: darwin/arm64)
  • Gno commit hash causing the issue (example: 84e53f5)

Steps to reproduce

Create an issue.gno file using snippet:

package issue

func Example(v any) {
	if v == nil {
		// This panic breaks filetests
		panic("boom!")
	}

	// This panic works as expected
	panic("boom!")
}

Create a z_filetest.gno file using snippet:

package main

import "gno.land/r/example/issue"

func main() {
	issue.Example(nil) // Assign nil to break filetest, non nil to pass
}

// Error:
// boom!

Create a gno.mod file using snippet:

module gno.land/r/example/issue

Expected behaviour

Filetest should run and pass.

Actual behaviour

Filetests run breaks.

Logs

=== RUN   file/z_filetest.gno
gno.land/r/example/issue:0: runtime error: invalid memory address or nil pointer dereference (code=2)
FAIL    . 	0.00s
FAIL
FAIL: 0 build errors, 1 test errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

1 participant