diff --git a/gnovm/cmd/gno/lint_test.go b/gnovm/cmd/gno/lint_test.go index 20d21c05d05..031c252bc79 100644 --- a/gnovm/cmd/gno/lint_test.go +++ b/gnovm/cmd/gno/lint_test.go @@ -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/"}, diff --git a/gnovm/cmd/gno/run_test.go b/gnovm/cmd/gno/run_test.go index e5aa1bd6279..74f99f7490c 100644 --- a/gnovm/cmd/gno/run_test.go +++ b/gnovm/cmd/gno/run_test.go @@ -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 diff --git a/gnovm/pkg/gnolang/machine_test.go b/gnovm/pkg/gnolang/machine_test.go index 81a5fb07139..41f30fe7802 100644 --- a/gnovm/pkg/gnolang/machine_test.go +++ b/gnovm/pkg/gnolang/machine_test.go @@ -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" @@ -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) - } - }, - }, - }) - }) - } -} diff --git a/gnovm/pkg/gnolang/testdata/TestMemPackage/fail/file_test.gno b/gnovm/pkg/gnolang/testdata/TestMemPackage/fail/file_test.gno deleted file mode 100644 index b202c40bc46..00000000000 --- a/gnovm/pkg/gnolang/testdata/TestMemPackage/fail/file_test.gno +++ /dev/null @@ -1,7 +0,0 @@ -package test - -import "testing" - -func TestFail(t *testing.T) { - t.Errorf("OUPS") -} diff --git a/gnovm/pkg/gnolang/testdata/TestMemPackage/success/file_test.gno b/gnovm/pkg/gnolang/testdata/TestMemPackage/success/file_test.gno deleted file mode 100644 index 0fc1d898199..00000000000 --- a/gnovm/pkg/gnolang/testdata/TestMemPackage/success/file_test.gno +++ /dev/null @@ -1,5 +0,0 @@ -package test - -import "testing" - -func TestSucess(t *testing.T) {}