Browse Source

Convert wpsBlankLine_test.go to use gocheck.

Geoffrey J. Teale 11 years ago
parent
commit
099ed5cd7a
1 changed files with 14 additions and 27 deletions
  1. 14 27
      wpsBlankLine_test.go

+ 14 - 27
wpsBlankLine_test.go

@@ -1,48 +1,35 @@
 package xlsx
 package xlsx
 
 
 import (
 import (
-	"testing"
+	. "gopkg.in/check.v1"
 )
 )
 
 
+type WpsBlankLineSuite struct {}
+var _ = Suite(&WorksheetSuite{})
+
 // Test that we can successfully read an XLSX file generated by
 // Test that we can successfully read an XLSX file generated by
 // Wps on windows. you can download it freely from http://www.wps.cn/
 // Wps on windows. you can download it freely from http://www.wps.cn/
-func TestWpsBlankLine(t *testing.T) {
-	xlsxFile, error := OpenFile("wpsBlankLineTest.xlsx")
-	if error != nil {
-		t.Error(error.Error())
-		return
-	}
-	if xlsxFile == nil {
-		t.Error("OpenFile returned nil FileInterface without generating an os.Error")
-		return
-	}
+func (w *WpsBlankLineSuite) TestWpsBlankLine(c *C) {
+	xlsxFile, err := OpenFile("wpsBlankLineTest.xlsx")
+	c.Assert(err, IsNil)
+	c.Assert(xlsxFile, NotNil)
 	sheet := xlsxFile.Sheets[0]
 	sheet := xlsxFile.Sheets[0]
 	row := sheet.Rows[0]
 	row := sheet.Rows[0]
 	cell := row.Cells[0]
 	cell := row.Cells[0]
 	s := cell.String()
 	s := cell.String()
 	expected := "编号"
 	expected := "编号"
-	if s != expected {
-		t.Errorf("[TestWpsBlankLine] expected cell A1 = '%s', but got :'%s'", expected, s)
-		return
-	}
+	c.Assert(s, Equals, expected)
+
 	row = sheet.Rows[2]
 	row = sheet.Rows[2]
 	cell = row.Cells[0]
 	cell = row.Cells[0]
 	s = cell.String()
 	s = cell.String()
-	if s != expected {
-		t.Errorf("[TestWpsBlankLine] expected cell A3 = '%s', but got :'%s'", expected, s)
-		return
-	}
+	c.Assert(s, Equals, expected)
 
 
 	row = sheet.Rows[4]
 	row = sheet.Rows[4]
 	cell = row.Cells[1]
 	cell = row.Cells[1]
 	s = cell.String()
 	s = cell.String()
-	if s != "" {
-		t.Errorf("[TestWpsBlankLine] expected cell B5 = '%s', but got :'%s'", "", s)
-		return
-	}
+	c.Assert(s, Equals, "")
+
 	s = sheet.Rows[4].Cells[2].String()
 	s = sheet.Rows[4].Cells[2].String()
-	if s != expected {
-		t.Errorf("[TestWpsBlankLine] expected cell C5 = '%s', but got :'%s'", expected, s)
-		return
-	}
+	c.Assert(s, Equals, expected)
 }
 }