Skip to content

Commit 3e7192b

Browse files
committed
Simple go test.
1 parent 565b23e commit 3e7192b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Diff for: excelize_test.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
_ "image/png"
88
"io/ioutil"
99
"strconv"
10+
"strings"
1011
"testing"
1112
"time"
1213
)
@@ -33,11 +34,7 @@ func TestOpenFile(t *testing.T) {
3334
xlsx.SetCellInt("SHEET2", "A1", 100)
3435
xlsx.SetCellStr("SHEET2", "C11", "Knowns")
3536
// Test max characters in a cell.
36-
var s = "c"
37-
for i := 0; i < 32768; i++ {
38-
s += "c"
39-
}
40-
xlsx.SetCellStr("SHEET2", "D11", s)
37+
xlsx.SetCellStr("SHEET2", "D11", strings.Repeat("c", 32769))
4138
xlsx.NewSheet(3, ":\\/?*[]Maximum 31 characters allowed in sheet title.")
4239
// Test set sheet name with illegal name.
4340
xlsx.SetSheetName("Maximum 31 characters allowed i", "[Rename]:\\/?* Maximum 31 characters allowed in sheet title.")
@@ -726,10 +723,7 @@ func TestAddComments(t *testing.T) {
726723
if err != nil {
727724
t.Log(err)
728725
}
729-
var s = "c"
730-
for i := 0; i < 32767; i++ {
731-
s += "c"
732-
}
726+
s := strings.Repeat("c", 32768)
733727
xlsx.AddComment("Sheet1", "A30", `{"author":"`+s+`","text":"`+s+`"}`)
734728
xlsx.AddComment("Sheet2", "B7", `{"author":"Excelize: ","text":"This is a comment."}`)
735729
err = xlsx.Save()

0 commit comments

Comments
 (0)