E8: run each file's unit tests as subtests of one test
The node-engine held 1,707 top-level unit tests against the budget of 500 a module. Each unit test file with two or more tests now runs them as subtests of one test named for the file, each named as its function was, in the same order: every check is kept, and the check counts 383. Files with a TestMain, a re-run of a test by its name, or the integration tag are left. Four files of this branch's earlier commits are formatted. Builds: design 47 H2 §819; H-A-349 DQ-14
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// The SDK's validator speaks the copied parser's vocabulary version (issue 1353 AC3).
|
||||
func TestVersionIsTheParsersVersion(t *testing.T) {
|
||||
func testVersionIsTheParsersVersion(t *testing.T) {
|
||||
if Version != declaration.Version {
|
||||
t.Fatalf("validate.Version = %d, declaration.Version = %d", Version, declaration.Version)
|
||||
}
|
||||
@@ -17,7 +17,7 @@ func TestVersionIsTheParsersVersion(t *testing.T) {
|
||||
|
||||
// A body of another declaration version is refused whole, by both the validator and the parser (AC3). The body is
|
||||
// the shape mesh-host's validate_test.go uses for its good declaration, with the version changed.
|
||||
func TestAnotherVersionIsRefusedWhole(t *testing.T) {
|
||||
func testAnotherVersionIsRefusedWhole(t *testing.T) {
|
||||
body := `{"declaration": 99, "resources": [{"id": "d", "type": "directory", "path": "/var/lib/x", "mode": "0755"}]}`
|
||||
problems := Declaration([]byte(body))
|
||||
if len(problems) == 0 {
|
||||
@@ -29,3 +29,9 @@ func TestAnotherVersionIsRefusedWhole(t *testing.T) {
|
||||
t.Fatalf("the parser and the validator disagree: %v / %v", err, problems)
|
||||
}
|
||||
}
|
||||
|
||||
// TestSdk runs this file's tests, each a subtest named as its function was (design 47 H2 §819, the test budget).
|
||||
func TestSdk(t *testing.T) {
|
||||
t.Run("VersionIsTheParsersVersion", testVersionIsTheParsersVersion)
|
||||
t.Run("AnotherVersionIsRefusedWhole", testAnotherVersionIsRefusedWhole)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user