Skip to content

Improve test coverage#234

Merged
philipch07 merged 1 commit intomasterfrom
pch07/improve-test-cov
Oct 22, 2025
Merged

Improve test coverage#234
philipch07 merged 1 commit intomasterfrom
pch07/improve-test-cov

Conversation

@philipch07
Copy link
Copy Markdown
Contributor

Description

title

Reference issue

Resolves #193.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.95%. Comparing base (9488911) to head (781e7e1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
+ Coverage   71.81%   74.95%   +3.14%     
==========================================
  Files          12       12              
  Lines        1685     1685              
==========================================
+ Hits         1210     1263      +53     
+ Misses        378      336      -42     
+ Partials       97       86      -11     
Flag Coverage Δ
go 74.95% <ø> (+3.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@philipch07 philipch07 force-pushed the pch07/improve-test-cov branch 2 times, most recently from f5ea1b8 to f522502 Compare October 21, 2025 23:50
Copy link
Copy Markdown
Member

@JoTurk JoTurk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

e := syntaxError{s: "hello", i: 1}
got := e.Error()
want := `sdp: syntax error at pos 1: "e"`
assert.Equal(t, want, got)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can assert the Error type not the message, which can change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I was quickly throwing stuff together, I meant for this to be a draft pr since I wanted to add more coverage across a couple files. Thanks for catching this, I'll update all the instances like this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok this is a little confusing. the e.Error() line returns a String instead of an actual error:

func (e syntaxError) Error() string {
	if e.i < 0 {
		e.i = 0
	}

	return fmt.Sprintf("sdp: syntax error at pos %d: %s", e.i, strconv.QuoteToASCII(e.s[e.i:e.i+1]))
}

So I don't think we can do an assert.ErrorIs(...) here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant if that error returns any value, maybe include the digit, but not the full message, because this error message isn't great and we can change it in the future, many times :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nitpick that is up to you, you can merge it as it's.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, I misinterpreted what you were saying. I changed it to just check the int now!

@philipch07 philipch07 marked this pull request as draft October 22, 2025 01:24
@philipch07 philipch07 force-pushed the pch07/improve-test-cov branch 3 times, most recently from 797b180 to 24298b8 Compare October 22, 2025 02:37
@philipch07 philipch07 force-pushed the pch07/improve-test-cov branch from 24298b8 to 781e7e1 Compare October 22, 2025 02:40
@philipch07
Copy link
Copy Markdown
Contributor Author

Unfortunately I wasn't able to finish this today, but I should be able to complete it tomorrow. The current cov is roughly 75%, I'll be shooting for 80% or more!

@JoTurk
Copy link
Copy Markdown
Member

JoTurk commented Oct 22, 2025

@philipch07 You can merge this for now if you want :)

@philipch07
Copy link
Copy Markdown
Contributor Author

@philipch07 You can merge this for now if you want :)

Sure. Thanks for reviewing!

@philipch07 philipch07 marked this pull request as ready for review October 22, 2025 02:49
@philipch07 philipch07 merged commit cc629db into master Oct 22, 2025
19 checks passed
@philipch07 philipch07 deleted the pch07/improve-test-cov branch October 22, 2025 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Expand Test Coverage and Upgrade Linting Rules

2 participants