Pārlūkot izejas kodu

Improve unit testing, remove redundant code.

xuri 7 gadi atpakaļ
vecāks
revīzija
167554bfec
3 mainītis faili ar 5 papildinājumiem un 7 dzēšanām
  1. 3 1
      excelize_test.go
  2. 0 6
      sheet.go
  3. 2 0
      templates.go

+ 3 - 1
excelize_test.go

@@ -82,6 +82,9 @@ func TestOpenFile(t *testing.T) {
 	xlsx.SetCellValue("Sheet2", "F14", uint32(1<<32-1))
 	xlsx.SetCellValue("Sheet2", "F14", uint32(1<<32-1))
 	xlsx.SetCellValue("Sheet2", "F15", uint64(1<<32-1))
 	xlsx.SetCellValue("Sheet2", "F15", uint64(1<<32-1))
 	xlsx.SetCellValue("Sheet2", "F16", true)
 	xlsx.SetCellValue("Sheet2", "F16", true)
+	xlsx.SetCellValue("Sheet2", "F17", complex64(5+10i))
+	t.Log(letterOnlyMapF('x'))
+	t.Log(deepCopy(nil, nil))
 	// Test boolean write
 	// Test boolean write
 	booltest := []struct {
 	booltest := []struct {
 		value    bool
 		value    bool
@@ -125,7 +128,6 @@ func TestOpenFile(t *testing.T) {
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
-
 }
 }
 
 
 func TestAddPicture(t *testing.T) {
 func TestAddPicture(t *testing.T) {

+ 0 - 6
sheet.go

@@ -193,12 +193,6 @@ func (f *File) setAppXML() {
 // library doesn't multiple namespace declarations in a single element of a
 // library doesn't multiple namespace declarations in a single element of a
 // document. This function is a horrible hack to fix that after the XML
 // document. This function is a horrible hack to fix that after the XML
 // marshalling is completed.
 // marshalling is completed.
-func replaceRelationshipsNameSpace(workbookMarshal string) string {
-	oldXmlns := `<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
-	newXmlns := `<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">`
-	return strings.Replace(workbookMarshal, oldXmlns, newXmlns, -1)
-}
-
 func replaceRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte {
 func replaceRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte {
 	oldXmlns := []byte(`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`)
 	oldXmlns := []byte(`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`)
 	newXmlns := []byte(`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">`)
 	newXmlns := []byte(`<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">`)

+ 2 - 0
templates.go

@@ -7,6 +7,8 @@ package excelize
 const XMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
 const XMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
 
 
 var (
 var (
+	// XMLHeaderByte define an XML declaration can also contain a standalone
+	// declaration.
 	XMLHeaderByte = []byte(XMLHeader)
 	XMLHeaderByte = []byte(XMLHeader)
 )
 )