Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointers & errors 100% test coverage #797

Open
SoroushBeigi opened this issue Aug 5, 2024 · 3 comments
Open

Pointers & errors 100% test coverage #797

SoroushBeigi opened this issue Aug 5, 2024 · 3 comments

Comments

@SoroushBeigi
Copy link

SoroushBeigi commented Aug 5, 2024

Pointers & errors chapter tests do not cover the whole codebase, because this function is not tested:

func (b Bitcoin) String() string {
	return fmt.Sprintf("%d BTC", b)
}

which can be covered with the test below:

t.Run("Bitcoin String", func(t *testing.T) {
		btc := Bitcoin(10)
		got := btc.String()
		want := "10 BTC"

		if got != want {
			t.Errorf("got %s want %s", got, want)
		}
	})

I strongly believe that we should encourage learners to find why the test coverage is not 100% and fix it as an assignment first.

@SoroushBeigi
Copy link
Author

@quii should I go for it?

@quii
Copy link
Owner

quii commented Aug 6, 2024

Sure, but do a quick draft first so I can help you

@SoroushBeigi
Copy link
Author

@quii I created this PR with basic practice exercise added. feel free to tell me any possible improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants