Skip to content

Conversation

@your-diary
Copy link
Contributor

Describe your changes

This PR adds C/C++ style assertions: lo.Assert and lo.Assertf.

Solves #634.

Feel free to correct my English as I'm not a native English speaker.

Checklist before requesting a review

  • 👓 I have performed a self-review of my code
  • 👶 This helper does not already exist
  • 🧪 This helper is tested
  • 🏎️ My code limits memory allocation and is fast
  • 🧞‍♂️ This helper is immutable and my tests prove it
  • ✍️ I implemented the parallel and mutable variants
  • 📖 My helper has been added to README
  • 🔬 An example has been added to xxxxx_example_test.go
  • ⛹️ An example has been created on https://go.dev/play

Conventions

  • Returning (ok bool) is often better than (err error)
  • panic(...) must be limited
  • Helpers should allow batching (eg: receive variadic arguments)
  • Use an index at the end of the helper name to declare variants (eg: lo.Must0, lo.Must1, lo.Must2...)

@codecov
Copy link

codecov bot commented Jun 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.41%. Comparing base (2b57de7) to head (b7518c1).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #638      +/-   ##
==========================================
+ Coverage   94.39%   94.41%   +0.02%     
==========================================
  Files          18       19       +1     
  Lines        3246     3261      +15     
==========================================
+ Hits         3064     3079      +15     
  Misses        170      170              
  Partials       12       12              
Flag Coverage Δ
unittests 94.41% <100.00%> (+0.02%) ⬆️

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.

@samber samber merged commit e9281d8 into samber:master Jun 1, 2025
12 of 27 checks passed
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

Successfully merging this pull request may close these issues.

2 participants