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

context.md assertWasCancelled() and assertWasNotCancelled #624

Open
bodowd opened this issue Dec 11, 2022 · 1 comment
Open

context.md assertWasCancelled() and assertWasNotCancelled #624

bodowd opened this issue Dec 11, 2022 · 1 comment

Comments

@bodowd
Copy link

bodowd commented Dec 11, 2022

Hello,
Not sure if I'm simply misunderstanding the following.
The text reads:

type SpyStore struct {
	response  string
	cancelled bool
	t         *testing.T
}

func (s *SpyStore) assertWasCancelled() {
	s.t.Helper()
	if !s.cancelled {
		s.t.Error("store was not told to cancel")
	}
}

func (s *SpyStore) assertWasNotCancelled() {
	s.t.Helper()
	if s.cancelled {
		s.t.Error("store was told to cancel")
	}
}

Should the Errors be reversed? In the text, it seems like it is saying "if not cancelled, throw an error because the store was not told to cancel". Is it intended to say: "if not cancelled, throw an error because the store was told to cancel"?

type SpyStore struct {
	response  string
	cancelled bool
	t         *testing.T
}

func (s *SpyStore) assertWasCancelled() {
	s.t.Helper()
	if !s.cancelled {
		s.t.Error("store was told to cancel")
	}
}

func (s *SpyStore) assertWasNotCancelled() {
	s.t.Helper()
	if s.cancelled {
		s.t.Error("store was not told to cancel")
	}
}

Thanks for your time

@quii
Copy link
Owner

quii commented Mar 3, 2023

I don't think so? If I have assertWasCancelled in my test, and it didn't, I'd expect to see store was not told to cancel

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