diff options
author | xuri <xuri.me@gmail.com> | 2019-10-26 20:55:24 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2019-10-26 20:55:24 +0800 |
commit | 5e418ebd665f38d1211b27d7157ec7e5868451bc (patch) | |
tree | a2e72dc8d5690856e8157e8208539c780ec631d6 /sheet_test.go | |
parent | 87390cdd99b3afbe07daeef9abe96f57d03cb352 (diff) |
Resolve #507, add the new function `DeleteDefinedName`
Diffstat (limited to 'sheet_test.go')
-rw-r--r-- | sheet_test.go | 10 |
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"))) } |