From 3231817169051fd2cd3452d276447e488a3a70b9 Mon Sep 17 00:00:00 2001 From: wangxuliBY <100419125+wangxuliBY@users.noreply.github.com> Date: Fri, 25 Feb 2022 21:37:49 +0800 Subject: This fixed code review issue in PR #1154 (#1159) --- workbook_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'workbook_test.go') diff --git a/workbook_test.go b/workbook_test.go index 90fc3d7..e31caf2 100644 --- a/workbook_test.go +++ b/workbook_test.go @@ -10,6 +10,7 @@ import ( func ExampleFile_SetWorkbookPrOptions() { f := NewFile() if err := f.SetWorkbookPrOptions( + FilterPrivacy(false), CodeName("code"), ); err != nil { fmt.Println(err) @@ -19,14 +20,22 @@ func ExampleFile_SetWorkbookPrOptions() { func ExampleFile_GetWorkbookPrOptions() { f := NewFile() - var codeName CodeName + var ( + filterPrivacy FilterPrivacy + codeName CodeName + ) + if err := f.GetWorkbookPrOptions(&filterPrivacy); err != nil { + fmt.Println(err) + } if err := f.GetWorkbookPrOptions(&codeName); err != nil { fmt.Println(err) } fmt.Println("Defaults:") + fmt.Printf("- filterPrivacy: %t\n", filterPrivacy) fmt.Printf("- codeName: %q\n", codeName) // Output: // Defaults: + // - filterPrivacy: true // - codeName: "" } @@ -40,4 +49,9 @@ func TestWorkbookPr(t *testing.T) { assert.NoError(t, f.SetWorkbookPrOptions(CodeName("code"))) assert.NoError(t, f.GetWorkbookPrOptions(&codeName)) assert.Equal(t, "code", string(codeName)) + + wb.WorkbookPr = nil + var filterPrivacy FilterPrivacy + assert.NoError(t, f.GetWorkbookPrOptions(&filterPrivacy)) + assert.Equal(t, false, bool(filterPrivacy)) } -- cgit v1.2.1