summaryrefslogtreecommitdiff
path: root/rows_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2020-04-24 08:26:16 +0800
committerxuri <xuri.me@gmail.com>2020-04-24 08:26:16 +0800
commit2285d4dc718fb8b96c3b2291c63b39c57468b0b9 (patch)
tree0690e862e54512d5ba676f8e2555954a112e5bf6 /rows_test.go
parent1fe660df648422a53eef0c735657cb2f5237ef7b (diff)
handle the cell without r attribute in a row element
Diffstat (limited to 'rows_test.go')
-rw-r--r--rows_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/rows_test.go b/rows_test.go
index e5f0524..fd7196d 100644
--- a/rows_test.go
+++ b/rows_test.go
@@ -831,6 +831,17 @@ func TestErrSheetNotExistError(t *testing.T) {
assert.EqualValues(t, err.Error(), "sheet Sheet1 is not exist")
}
+func TestCheckRow(t *testing.T) {
+ f := NewFile()
+ f.XLSX["xl/worksheets/sheet1.xml"] = []byte(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" ><sheetData><row r="2"><c><v>1</v></c><c r="F2"><v>2</v></c><c><v>3</v></c><c><v>4</v></c><c r="M2"><v>5</v></c></row></sheetData></worksheet>`)
+ _, err := f.GetRows("Sheet1")
+ assert.NoError(t, err)
+ assert.NoError(t, f.SetCellValue("Sheet1", "A1", false))
+ f = NewFile()
+ f.XLSX["xl/worksheets/sheet1.xml"] = []byte(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" ><sheetData><row r="2"><c><v>1</v></c><c r="-"><v>2</v></c><c><v>3</v></c><c><v>4</v></c><c r="M2"><v>5</v></c></row></sheetData></worksheet>`)
+ assert.EqualError(t, f.SetCellValue("Sheet1", "A1", false), `cannot convert cell "-" to coordinates: invalid cell name "-"`)
+}
+
func BenchmarkRows(b *testing.B) {
f, _ := OpenFile(filepath.Join("test", "Book1.xlsx"))
for i := 0; i < b.N; i++ {