Skip to content

Commit

Permalink
remove useless test
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Nov 19, 2024
1 parent ee2b0da commit 3f9abe1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 77 deletions.
8 changes: 4 additions & 4 deletions gnovm/cmd/gno/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ func TestLintApp(t *testing.T) {
errShouldBe: "exit code: 1",
}, {
args: []string{"lint", "../../tests/integ/undefined_variable_test/undefined_variables_test.gno"},
stderrShouldContain: "undefined_variables_test.gno:6: name toto not declared (code=2)",
stderrShouldContain: "undefined_variables_test.gno:6:28: name toto not declared (code=2)",
errShouldBe: "exit code: 1",
}, {
args: []string{"lint", "../../tests/integ/package_not_declared/main.gno"},
stderrShouldContain: "main.gno:4: name fmt not declared (code=2).",
stderrShouldContain: "main.gno:4:2: name fmt not declared (code=2).",
errShouldBe: "exit code: 1",
}, {
args: []string{"lint", "../../tests/integ/several-lint-errors/main.gno"},
stderrShouldContain: "../../tests/integ/several-lint-errors/main.gno:5: expected ';', found example (code=2).\n../../tests/integ/several-lint-errors/main.gno:6",
stderrShouldContain: "../../tests/integ/several-lint-errors/main.gno:5:5: expected ';', found example (code=2).\n../../tests/integ/several-lint-errors/main.gno:6",
errShouldBe: "exit code: 1",
}, {
args: []string{"lint", "../../tests/integ/several-files-multiple-errors/main.gno"},
stderrShouldContain: "../../tests/integ/several-files-multiple-errors/file2.gno:3: expected 'IDENT', found '{' (code=2).\n../../tests/integ/several-files-multiple-errors/file2.gno:5: expected type, found '}' (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:5: expected ';', found example (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:6: expected '}', found 'EOF' (code=2).\n",
stderrShouldContain: "../../tests/integ/several-files-multiple-errors/file2.gno:3:5: expected 'IDENT', found '{' (code=2).\n../../tests/integ/several-files-multiple-errors/file2.gno:5:1: expected type, found '}' (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:5:5: expected ';', found example (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:6:2: expected '}', found 'EOF' (code=2).\n",
errShouldBe: "exit code: 1",
}, {
args: []string{"lint", "../../tests/integ/run_main/"},
Expand Down
2 changes: 1 addition & 1 deletion gnovm/cmd/gno/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestRunApp(t *testing.T) {
},
{
args: []string{"run", "../../tests/integ/several-files-multiple-errors/"},
stderrShouldContain: "../../tests/integ/several-files-multiple-errors/file2.gno:3: expected 'IDENT', found '{' (code=2).\n../../tests/integ/several-files-multiple-errors/file2.gno:5: expected type, found '}' (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:5: expected ';', found example (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:6: expected '}', found 'EOF' (code=2).",
stderrShouldContain: "../../tests/integ/several-files-multiple-errors/file2.gno:3:5: expected 'IDENT', found '{' (code=2).\n../../tests/integ/several-files-multiple-errors/file2.gno:5:1: expected type, found '}' (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:5:5: expected ';', found example (code=2).\n../../tests/integ/several-files-multiple-errors/main.gno:6:2: expected '}', found 'EOF' (code=2).\n",
errShouldBe: "exit code: 1",
},
// TODO: a test file
Expand Down
60 changes: 0 additions & 60 deletions gnovm/pkg/gnolang/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ package gnolang_test

import (
"fmt"
"os"
"path/filepath"
"testing"

"github.com/gnolang/gno/gnovm"
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/gnovm/pkg/test"
"github.com/gnolang/gno/tm2/pkg/db/memdb"
"github.com/gnolang/gno/tm2/pkg/store/dbadapter"
"github.com/gnolang/gno/tm2/pkg/store/iavl"
Expand Down Expand Up @@ -60,60 +57,3 @@ func TestRunMemPackageWithOverrides_revertToOld(t *testing.T) {
assert.Equal(t, gno.StringKind, v.T.Kind())
assert.Equal(t, gno.StringValue("1"), v.V)
}

func TestMachineTestMemPackage(t *testing.T) {
matchFunc := func(pat, str string) (bool, error) { return true, nil }

tests := []struct {
name string
path string
shouldSucceed bool
}{
{
name: "TestSuccess",
path: "testdata/TestMemPackage/success",
shouldSucceed: true,
},
{
name: "TestFail",
path: "testdata/TestMemPackage/fail",
shouldSucceed: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// NOTE: Because the purpose of this test is to ensure testing.T.Failed()
// returns true if a gno test is failing, and because we don't want this
// to affect the current testing.T, we are creating an other one thanks
// to testing.RunTests() function.
testing.RunTests(matchFunc, []testing.InternalTest{
{
Name: tt.name,
F: func(t2 *testing.T) { //nolint:thelper
rootDir := filepath.Join("..", "..", "..")
_, store := test.Store(rootDir, false, os.Stdin, os.Stdout, os.Stderr)
store.SetLogStoreOps(true)
m := gno.NewMachineWithOptions(gno.MachineOptions{
PkgPath: "test",
Output: os.Stdout,
Store: store,
Context: nil,
})
memPkg := gno.ReadMemPackage(tt.path, "test")

_, _ = memPkg, m
panic("RE-IMPLEMENT")
// XXX TODO
// m.TestMemPackage(t2, memPkg)

if tt.shouldSucceed {
assert.False(t, t2.Failed(), "test %q should have succeed", tt.name)
} else {
assert.True(t, t2.Failed(), "test %q should have failed", tt.name)
}
},
},
})
})
}
}
7 changes: 0 additions & 7 deletions gnovm/pkg/gnolang/testdata/TestMemPackage/fail/file_test.gno

This file was deleted.

This file was deleted.

0 comments on commit 3f9abe1

Please sign in to comment.