diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-06-19 17:38:23 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-06-19 17:38:23 +0800 |
commit | 0743243dce05c38c1f4949e44467d20a22a1f743 (patch) | |
tree | fdb2b2dd419da47bb314f230957f79a9d01353d6 /tests/transaction_test_util.go | |
parent | a9659e6dcf1f1584e155825d4422eb005ff38c21 (diff) | |
download | go-tangerine-0743243dce05c38c1f4949e44467d20a22a1f743.tar.gz go-tangerine-0743243dce05c38c1f4949e44467d20a22a1f743.tar.zst go-tangerine-0743243dce05c38c1f4949e44467d20a22a1f743.zip |
Add --skip option to CLI
Disassociates hardcoded tests to skip when running via CLI. Tests still
skipped when running `go test`
Diffstat (limited to 'tests/transaction_test_util.go')
-rw-r--r-- | tests/transaction_test_util.go | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go index af33f2c58..45caf26fd 100644 --- a/tests/transaction_test_util.go +++ b/tests/transaction_test_util.go @@ -32,9 +32,9 @@ type TransactionTest struct { Transaction TtTransaction } -func RunTransactionTestsWithReader(r io.Reader) error { - skipTest := make(map[string]bool, len(TransSkipTests)) - for _, name := range TransSkipTests { +func RunTransactionTestsWithReader(r io.Reader, skipTests []string) error { + skipTest := make(map[string]bool, len(skipTests)) + for _, name := range skipTests { skipTest[name] = true } @@ -59,18 +59,25 @@ func RunTransactionTestsWithReader(r io.Reader) error { return nil } -func RunTransactionTests(file string) error { - skipTest := make(map[string]bool, len(TransSkipTests)) - for _, name := range TransSkipTests { - skipTest[name] = true +func RunTransactionTests(file string, skipTests []string) error { + tests := make(map[string]TransactionTest) + if err := readJsonFile(file, &tests); err != nil { + return err } - bt := make(map[string]TransactionTest) - if err := readJsonFile(file, &bt); err != nil { + if err := runTransactionTests(tests, skipTests); err != nil { return err } + return nil +} - for name, test := range bt { +func runTransactionTests(tests map[string]TransactionTest, skipTests []string) error { + skipTest := make(map[string]bool, len(skipTests)) + for _, name := range skipTests { + skipTest[name] = true + } + + for name, test := range tests { // if the test should be skipped, return if skipTest[name] { glog.Infoln("Skipping transaction test", name) |