Skip to content

Commit

Permalink
skip testsuite tests if env does not include TESTSUITE=MUST
Browse files Browse the repository at this point in the history
  • Loading branch information
awalterschulze committed Jan 14, 2025
1 parent 96d2a02 commit 210f46e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ checklicense:
.txt

test:
go test ./...
TESTSUITE=MUST go test ./...

build:
go build ./...
Expand Down
8 changes: 6 additions & 2 deletions validator/auto/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ import (
)

func TestSuite(t *testing.T) {
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
exists, err := testsuite.TestSuiteExists()
if !exists {
if err != nil {
t.Fatal(err)
}
t.Skip()
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions validator/intern/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ import (
)

func TestSuite(t *testing.T) {
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
exists, err := testsuite.TestSuiteExists()
if !exists {
if err != nil {
t.Fatal(err)
}
t.Skip()
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions validator/interp/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ import (
)

func TestSuite(t *testing.T) {
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
exists, err := testsuite.TestSuiteExists()
if !exists {
if err != nil {
t.Fatal(err)
}
t.Skip()
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
8 changes: 6 additions & 2 deletions validator/mem/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ import (
)

func TestSuite(t *testing.T) {
if err := testsuite.TestSuiteExists(); err != nil {
t.Fatal(err)
exists, err := testsuite.TestSuiteExists()
if !exists {
if err != nil {
t.Fatal(err)
}
t.Skip()
}
tests, err := testsuite.ReadTestSuite()
if err != nil {
Expand Down
11 changes: 7 additions & 4 deletions validator/testsuite/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"path/filepath"
"strings"

"github.com/katydid/parser-go/parser"
"github.com/katydid/parser-go-json/json"
"github.com/katydid/parser-go-xml/xml"
"github.com/katydid/parser-go/parser"
"github.com/katydid/validator-go/validator"
"github.com/katydid/validator-go/validator/ast"
)
Expand All @@ -45,11 +45,14 @@ func init() {
benchpath = filepath.Join(gopath, "src/github.com/katydid/testsuite/validator/benches")
}

func TestSuiteExists() error {
func TestSuiteExists() (bool, error) {
if exists(testpath) {
return nil
return true, nil
}
if os.Getenv("TESTSUITE") == "MUST" {
return false, fmt.Errorf("testsuite does not exist at %v", testpath)
}
return fmt.Errorf("testsuite does not exist at %v", testpath)
return false, nil
}

func BenchSuiteExists() error {
Expand Down

0 comments on commit 210f46e

Please sign in to comment.