From 3e7192b6abaa9c8db29a2e34867879ebc9fedca7 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Mon, 11 Sep 2017 15:53:25 +0800 Subject: [PATCH] Simple go test. --- excelize_test.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/excelize_test.go b/excelize_test.go index 1129002..2529870 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -7,6 +7,7 @@ import ( _ "image/png" "io/ioutil" "strconv" + "strings" "testing" "time" ) @@ -33,11 +34,7 @@ func TestOpenFile(t *testing.T) { xlsx.SetCellInt("SHEET2", "A1", 100) xlsx.SetCellStr("SHEET2", "C11", "Knowns") // Test max characters in a cell. - var s = "c" - for i := 0; i < 32768; i++ { - s += "c" - } - xlsx.SetCellStr("SHEET2", "D11", s) + xlsx.SetCellStr("SHEET2", "D11", strings.Repeat("c", 32769)) xlsx.NewSheet(3, ":\\/?*[]Maximum 31 characters allowed in sheet title.") // Test set sheet name with illegal name. xlsx.SetSheetName("Maximum 31 characters allowed i", "[Rename]:\\/?* Maximum 31 characters allowed in sheet title.") @@ -726,10 +723,7 @@ func TestAddComments(t *testing.T) { if err != nil { t.Log(err) } - var s = "c" - for i := 0; i < 32767; i++ { - s += "c" - } + s := strings.Repeat("c", 32768) xlsx.AddComment("Sheet1", "A30", `{"author":"`+s+`","text":"`+s+`"}`) xlsx.AddComment("Sheet2", "B7", `{"author":"Excelize: ","text":"This is a comment."}`) err = xlsx.Save()