Skip to content

test(cmd/gnoland): add test to ensure to not import tests/stdlibs #3589

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

Merged
20 changes: 20 additions & 0 deletions gno.land/cmd/gnoland/imports_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import (
"os/exec"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestNoTestingStdlibImport(t *testing.T) {
// See: https://github.com/gnolang/gno/issues/3585
// The gno.land binary should not import testing stdlibs, which contain unsafe
// code in the respective native bindings.

res, err := exec.Command("go", "list", "-f", `{{ join .Deps "\n" }}`, ".").CombinedOutput()
require.NoError(t, err)
assert.Contains(t, string(res), "github.com/gnolang/gno/gnovm/stdlibs\n", "should contain normal stdlibs")
assert.NotContains(t, string(res), "github.com/gnolang/gno/gnovm/tests/stdlibs\n", "should not contain test stdlibs")
}
Loading