diff options
author | Daniel Langesten <daniel.langest@gmail.com> | 2015-03-27 10:32:38 +0100 |
---|---|---|
committer | Daniel Langesten <daniel.langest@gmail.com> | 2015-03-27 10:32:38 +0100 |
commit | 36cab6e2dac9935931a6b15f9c24c0c0151a9afe (patch) | |
tree | ac06b8674ebbd857ab6140f995f63accba90c7bd | |
parent | 3d65dca48ee28d542e7878e5fb988e9eb35f0644 (diff) |
better error handling in testcases
-rw-r--r-- | flow-cleaner_test.go | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/flow-cleaner_test.go b/flow-cleaner_test.go index 08608bd..93d7d76 100644 --- a/flow-cleaner_test.go +++ b/flow-cleaner_test.go @@ -119,7 +119,7 @@ func testProcessFromStdin(t *testing.T, cfg *Config) { rDatChan := parseRawData(stdin, cfg) err := cleanFromStdin(rDatChan, cfg) if err != nil { - t.Fatal(err) + t.Error(err) } } @@ -162,7 +162,7 @@ func controlRawDBStdin(t *testing.T, cfg *Config) { numRows++ } if numRows != 33 { - t.Fatal("Wrong number of rows found in db, should be 33 found:", numRows) + t.Error("Wrong number of rows found in db, should be 33 found:", numRows) } } @@ -184,7 +184,7 @@ func controlRawDBMySQL(t *testing.T, cfg *Config) { numRows++ } if numRows != 3 { - t.Fatal("Wrong number of rows found in db, should be 3 found:", numRows) + t.Error("Wrong number of rows found in db, should be 3 found:", numRows) } } @@ -206,7 +206,7 @@ func controlCleanDB(t *testing.T, cfg *Config) { numRows++ } if numRows != 14 { - t.Fatal("Wrong number of rows found in db, should be 14 found:", numRows) + t.Error("Wrong number of rows found in db, should be 14 found:", numRows) } check1, err := db.Query("SELECT occurences, volume FROM " + cfg.CleanTable + " ORDER BY occurences DESC") @@ -214,77 +214,77 @@ func controlCleanDB(t *testing.T, cfg *Config) { t.Fatal("Failed to select occurences and volume:", err) } defer check1.Close() - var oc int + var occurences int var vol string check1.Next() - check1.Scan(&oc, &vol) - if oc != 36 && vol == "0-199" { - t.Fatal("Failed oc 36, vol 0-199. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 36 && vol == "0-199" { + t.Error("Failed occurences 36, vol 0-199. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 20 && vol == "200-299" { - t.Fatal("Failed oc 20, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 20 && vol == "200-299" { + t.Error("Failed occurences 20, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 18 && vol == "200-299" { - t.Fatal("Failed oc 18, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 18 && vol == "200-299" { + t.Error("Failed occurences 18, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 14 && vol == "200-299" { - t.Fatal("Failed oc 14, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 14 && vol == "200-299" { + t.Error("Failed occurences 14, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 12 && vol == "200-299" { - t.Fatal("Failed oc 12, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 12 && vol == "200-299" { + t.Error("Failed occurences 12, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 10 && vol == "200-299" { - t.Fatal("Failed oc 10, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 10 && vol == "200-299" { + t.Error("Failed occurences 10, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 8 && vol == "200-299" { - t.Fatal("Failed oc 8, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 8 && vol == "200-299" { + t.Error("Failed occurences 8, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 7 && vol == "200-299" { - t.Fatal("Failed oc 7, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 7 && vol == "200-299" { + t.Error("Failed occurences 7, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 6 && vol == "200-299" { - t.Fatal("Failed oc 6, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 6 && vol == "200-299" { + t.Error("Failed occurences 6, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 4 && vol == "200-299" { - t.Fatal("Failed oc 4, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 4 && vol == "200-299" { + t.Error("Failed occurences 4, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 2 && vol == "200-299" { - t.Fatal("Failed oc 2, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 2 && vol == "200-299" { + t.Error("Failed occurences 2, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 1 && vol == "200-299" { - t.Fatal("Failed oc 1, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 1 && vol == "200-299" { + t.Error("Failed occurences 1, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 0 && vol == "200-299" { - t.Fatal("Failed oc 0, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 0 && vol == "200-299" { + t.Error("Failed occurences 0, vol 200-299. Actually was:", occurences, vol) } check1.Next() - check1.Scan(&oc, &vol) - if oc != 0 && vol == "200-299" { - t.Fatal("Failed oc 0, vol 200-299. Actually was:", oc, vol) + check1.Scan(&occurences, &vol) + if occurences != 0 && vol == "200-299" { + t.Error("Failed occurences 0, vol 200-299. Actually was:", occurences, vol) } } |