Skip to content

[RFC] Forbid import cycles in *_test.gno files? #1394

@harry-hov

Description

@harry-hov

Description

A while back I noticed we can self import a pkg in _test.gno files. For example this is a totally valid gno test file.

avl_test.gno:

package avl // import path `gno.land/p/demo/avl`

import (
       "testing"

       "gno.land/p/demo/avl" // importing itself
)

func TestXXX(t *testing.T) {
	t := avl.Tree{}
	_ = t
}

I'm aware that we never run _test.gno files on chain. But since we publish them on chain and are a part of pkg/realm. We should validate them before publishing and disallow self import to keep the behaviour consistent with Go.

--

PR #1206 highlights/removes all the instances of import cycles in _test.gno files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions