Explorar el Código

Add and test NewFile function

Geoffrey J. Teale hace 11 años
padre
commit
4e42553b15
Se han modificado 2 ficheros con 13 adiciones y 0 borrados
  1. 5 0
      lib.go
  2. 8 0
      lib_test.go

+ 5 - 0
lib.go

@@ -590,3 +590,8 @@ func ReadZipReader(r *zip.Reader) (*File, error) {
 	file.Sheet = sheetMap
 	file.Sheet = sheetMap
 	return file, nil
 	return file, nil
 }
 }
+
+
+func NewFile() *File {
+	return &File{};
+}

+ 8 - 0
lib_test.go

@@ -24,6 +24,14 @@ func (l *LibSuite) TestOpenFile(c *C) {
 
 
 }
 }
 
 
+// Test we can create a File object from scratch
+func (l *LibSuite) TestCreateFile(c *C) {
+	var xlsxFile *File
+
+	xlsxFile = NewFile()
+	c.Assert(xlsxFile, NotNil)
+}
+
 // Test that when we open a real XLSX file we create xlsx.Sheet
 // Test that when we open a real XLSX file we create xlsx.Sheet
 // objects for the sheets inside the file and that these sheets are
 // objects for the sheets inside the file and that these sheets are
 // themselves correct.
 // themselves correct.