Skip to content

Commit

Permalink
test(cmd/gnoland): add test to ensure to not import tests/stdlibs (#3589
Browse files Browse the repository at this point in the history
)

Fixes #3585
  • Loading branch information
thehowl authored Feb 6, 2025
1 parent dd0360d commit 37ab807
Showing 1 changed file with 20 additions and 0 deletions.
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")
}

0 comments on commit 37ab807

Please sign in to comment.