diff options
author | Thomas Charbonnel <thomascharbonnel@users.noreply.github.com> | 2022-08-11 00:20:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-11 00:20:48 +0800 |
commit | ed91cddea59ce15da87ab744ac20b465a36ed5ef (patch) | |
tree | 1ab4a75b5a903e20253a93393bc9561bb86ed186 /sheet_test.go | |
parent | b8ceaf7bf61daecad8717abec90a8e0badb64806 (diff) |
This closes #1296, add new function `GetRowOpts` for stream reader (#1297)
- Support get rows properties by `GetRowOpts` function
- New exported constant `MaxCellStyles`
Diffstat (limited to 'sheet_test.go')
-rw-r--r-- | sheet_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sheet_test.go b/sheet_test.go index c68ad31..9b0caf4 100644 --- a/sheet_test.go +++ b/sheet_test.go @@ -505,3 +505,29 @@ func newSheetWithSave() { } _ = file.Save() } + +func TestAttrValToBool(t *testing.T) { + _, err := attrValToBool("hidden", []xml.Attr{ + {Name: xml.Name{Local: "hidden"}}, + }) + assert.EqualError(t, err, `strconv.ParseBool: parsing "": invalid syntax`) + + got, err := attrValToBool("hidden", []xml.Attr{ + {Name: xml.Name{Local: "hidden"}, Value: "1"}, + }) + assert.NoError(t, err) + assert.Equal(t, true, got) +} + +func TestAttrValToFloat(t *testing.T) { + _, err := attrValToFloat("ht", []xml.Attr{ + {Name: xml.Name{Local: "ht"}}, + }) + assert.EqualError(t, err, `strconv.ParseFloat: parsing "": invalid syntax`) + + got, err := attrValToFloat("ht", []xml.Attr{ + {Name: xml.Name{Local: "ht"}, Value: "42.1"}, + }) + assert.NoError(t, err) + assert.Equal(t, 42.1, got) +} |