Add --skip option to CLI

Disassociates hardcoded tests to skip when running via CLI. Tests still
skipped when running `go test`
This commit is contained in:
Taylor Gerring
2015-06-19 11:38:23 +02:00
parent a9659e6dcf
commit 0743243dce
9 changed files with 96 additions and 81 deletions

View File

@@ -86,7 +86,7 @@ type btTransaction struct {
Value string
}
func RunBlockTestWithReader(r io.Reader) error {
func RunBlockTestWithReader(r io.Reader, skipTests []string) error {
btjs := make(map[string]*btJSON)
if err := readJson(r, &btjs); err != nil {
return err
@@ -97,13 +97,13 @@ func RunBlockTestWithReader(r io.Reader) error {
return err
}
if err := runBlockTests(bt); err != nil {
if err := runBlockTests(bt, skipTests); err != nil {
return err
}
return nil
}
func RunBlockTest(file string) error {
func RunBlockTest(file string, skipTests []string) error {
btjs := make(map[string]*btJSON)
if err := readJsonFile(file, &btjs); err != nil {
return err
@@ -113,15 +113,15 @@ func RunBlockTest(file string) error {
if err != nil {
return err
}
if err := runBlockTests(bt); err != nil {
if err := runBlockTests(bt, skipTests); err != nil {
return err
}
return nil
}
func runBlockTests(bt map[string]*BlockTest) error {
skipTest := make(map[string]bool, len(BlockSkipTests))
for _, name := range BlockSkipTests {
func runBlockTests(bt map[string]*BlockTest, skipTests []string) error {
skipTest := make(map[string]bool, len(skipTests))
for _, name := range skipTests {
skipTest[name] = true
}