summaryrefslogtreecommitdiff
path: root/sheet_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'sheet_test.go')
-rw-r--r--sheet_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/sheet_test.go b/sheet_test.go
index ea345a3..b9e4abf 100644
--- a/sheet_test.go
+++ b/sheet_test.go
@@ -210,8 +210,16 @@ func TestDefinedName(t *testing.T) {
Name: "Amount",
RefersTo: "Sheet1!$A$2:$D$5",
Comment: "defined name comment",
- }), "the same name already exists on scope")
+ }), "the same name already exists on the scope")
+ assert.EqualError(t, f.DeleteDefinedName(&excelize.DefinedName{
+ Name: "No Exist Defined Name",
+ }), "no defined name on the scope")
assert.Exactly(t, "Sheet1!$A$2:$D$5", f.GetDefinedName()[1].RefersTo)
+ assert.NoError(t, f.DeleteDefinedName(&excelize.DefinedName{
+ Name: "Amount",
+ }))
+ assert.Exactly(t, "Sheet1!$A$2:$D$5", f.GetDefinedName()[0].RefersTo)
+ assert.Exactly(t, 1, len(f.GetDefinedName()))
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestDefinedName.xlsx")))
}