diff options
author | Veniamin Albaev <albenik@gmail.com> | 2018-12-27 13:51:44 +0300 |
---|---|---|
committer | Veniamin Albaev <albenik@gmail.com> | 2018-12-27 13:51:44 +0300 |
commit | 35426ed5dc5196374332498c82b4d480b05e5ac5 (patch) | |
tree | 5831d8dbf3418d4036bedc26c7ec8e41ba3d3f1c /cell_test.go | |
parent | 9a6f66a996eb83f16da13416c5fca361afe575b0 (diff) |
Tests refactoring
Primary motivation: Avoid statefull tests with not ignorable git file tree changes.
Multiple tests reads and overwrites signle file for won needs.
Multiple tests reads and overwrites file under version control.
Secondary motivation: Minimal tests logic aligment, separate error expectation
and not error expectation tests. Introduce sub-test over test data sets and so far.
This commit is not ideal but necessary (IMHO)
Diffstat (limited to 'cell_test.go')
-rw-r--r-- | cell_test.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/cell_test.go b/cell_test.go index 4f9accd..cb3d80e 100644 --- a/cell_test.go +++ b/cell_test.go @@ -1,6 +1,10 @@ package excelize -import "testing" +import ( + "testing" + + "github.com/stretchr/testify/assert" +) func TestCheckCellInArea(t *testing.T) { expectedTrueCellInAreaList := [][2]string{ @@ -14,11 +18,8 @@ func TestCheckCellInArea(t *testing.T) { cell := expectedTrueCellInArea[0] area := expectedTrueCellInArea[1] - cellInArea := checkCellInArea(cell, area) - - if !cellInArea { - t.Fatalf("Expected cell %v to be in area %v, got false\n", cell, area) - } + assert.True(t, checkCellInArea(cell, area), + "Expected cell %v to be in area %v, got false\n", cell, area) } expectedFalseCellInAreaList := [][2]string{ @@ -31,10 +32,7 @@ func TestCheckCellInArea(t *testing.T) { cell := expectedFalseCellInArea[0] area := expectedFalseCellInArea[1] - cellInArea := checkCellInArea(cell, area) - - if cellInArea { - t.Fatalf("Expected cell %v not to be inside of area %v, but got true\n", cell, area) - } + assert.False(t, checkCellInArea(cell, area), + "Expected cell %v not to be inside of area %v, but got true\n", cell, area) } } |