Browse Source

Convert macExcel_test.go to use gocheck.

Geoffrey J. Teale 11 years ago
parent
commit
2029beebb5
1 changed files with 11 additions and 15 deletions
  1. 11 15
      macExcel_test.go

+ 11 - 15
macExcel_test.go

@@ -1,26 +1,22 @@
 package xlsx
 
 import (
-	"testing"
+	. "gopkg.in/check.v1"
 )
 
+
+type MacExcelSuite struct {}
+var _  = Suite(&MacExcelSuite{})
+
+
 // Test that we can successfully read an XLSX file generated by
 // Microsoft Excel for Mac.  In particular this requires that we
 // respect the contents of workbook.xml.rels, which maps the sheet IDs
 // to their internal file names.
-func TestMacExcel(t *testing.T) {
-	xlsxFile, error := OpenFile("macExcelTest.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 (m *MacExcelSuite) TestMacExcel(c *C) {
+	xlsxFile, err := OpenFile("macExcelTest.xlsx")
+	c.Assert(err, IsNil)
+	c.Assert(xlsxFile, NotNil)
 	s := xlsxFile.Sheets[0].Cell(0, 0).String()
-	if s != "编号" {
-		t.Errorf("[TestMacExcel] xlsxFile.Sheets[0].Cell(0,0).String():'%s'", s)
-		return
-	}
+	c.Assert(s, Equals, "编号")
 }