From 95c762ae4c3c85f3d8e751bfccf25e9f1cb78c88 Mon Sep 17 00:00:00 2001 From: Atsushi Watanabe Date: Tue, 9 Apr 2024 10:58:59 +0900 Subject: [PATCH] Add code to be covered by test To output valid coverage report --- dummy.go | 13 +++++++++++++ dummy_test.go | 2 ++ 2 files changed, 15 insertions(+) diff --git a/dummy.go b/dummy.go index 37baf39..ce81abc 100644 --- a/dummy.go +++ b/dummy.go @@ -6,6 +6,7 @@ package sandbox import ( "errors" + "log" _ "github.com/pion/transport/v3/test" // nolint ) @@ -17,3 +18,15 @@ var ErrDummy = errors.New("dummy") type PublicAPI struct { PublicMember int } + +// PublicFunc is a dummy public method. +func (p *PublicAPI) PublicFunc() { + log.Println("Running PublicAPI.PublicFunc") // nolint:forbidigo + log.Println("PublicAPI.PublicMember: ", p.PublicMember) // nolint:forbidigo + if p.PublicMember == 1 { + log.Println("PublicAPI.PublicMember is one") // nolint:forbidigo + } + if p.PublicMember != 1 { + log.Println("PublicAPI.PublicMember is not one") // nolint:forbidigo + } +} diff --git a/dummy_test.go b/dummy_test.go index 95ff4c9..a4d155d 100644 --- a/dummy_test.go +++ b/dummy_test.go @@ -10,4 +10,6 @@ import ( ) func TestDummy(*testing.T) { + p := &PublicAPI{} + p.PublicFunc() }