summaryrefslogtreecommitdiff
path: root/pivotTable_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2019-12-24 01:09:28 +0800
committerxuri <xuri.me@gmail.com>2019-12-24 01:09:28 +0800
commit1666d04559d9f5b579ab7c850ccc95863c31bd25 (patch)
treee04b4e3b3dc4e42bf87547163f73a970eae85487 /pivotTable_test.go
parent4e4a5b9b3e052d1694442515492792fb1aa74c5a (diff)
optimization: checking error in unit tests
Diffstat (limited to 'pivotTable_test.go')
-rw-r--r--pivotTable_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pivotTable_test.go b/pivotTable_test.go
index 9bf08e8..5d841d8 100644
--- a/pivotTable_test.go
+++ b/pivotTable_test.go
@@ -16,13 +16,13 @@ func TestAddPivotTable(t *testing.T) {
year := []int{2017, 2018, 2019}
types := []string{"Meat", "Dairy", "Beverages", "Produce"}
region := []string{"East", "West", "North", "South"}
- f.SetSheetRow("Sheet1", "A1", &[]string{"Month", "Year", "Type", "Sales", "Region"})
+ assert.NoError(t, f.SetSheetRow("Sheet1", "A1", &[]string{"Month", "Year", "Type", "Sales", "Region"}))
for i := 0; i < 30; i++ {
- f.SetCellValue("Sheet1", fmt.Sprintf("A%d", i+2), month[rand.Intn(12)])
- f.SetCellValue("Sheet1", fmt.Sprintf("B%d", i+2), year[rand.Intn(3)])
- f.SetCellValue("Sheet1", fmt.Sprintf("C%d", i+2), types[rand.Intn(4)])
- f.SetCellValue("Sheet1", fmt.Sprintf("D%d", i+2), rand.Intn(5000))
- f.SetCellValue("Sheet1", fmt.Sprintf("E%d", i+2), region[rand.Intn(4)])
+ assert.NoError(t, f.SetCellValue("Sheet1", fmt.Sprintf("A%d", i+2), month[rand.Intn(12)]))
+ assert.NoError(t, f.SetCellValue("Sheet1", fmt.Sprintf("B%d", i+2), year[rand.Intn(3)]))
+ assert.NoError(t, f.SetCellValue("Sheet1", fmt.Sprintf("C%d", i+2), types[rand.Intn(4)]))
+ assert.NoError(t, f.SetCellValue("Sheet1", fmt.Sprintf("D%d", i+2), rand.Intn(5000)))
+ assert.NoError(t, f.SetCellValue("Sheet1", fmt.Sprintf("E%d", i+2), region[rand.Intn(4)]))
}
assert.NoError(t, f.AddPivotTable(&PivotTableOption{
DataRange: "Sheet1!$A$1:$E$31",