Skip to content

Conversation

@rjNemo
Copy link
Owner

@rjNemo rjNemo commented Nov 14, 2025

Summary

  • Add explicit panic with clear error message for Last() on empty slices
  • Update documentation to note panic behavior
  • Existing tests already cover this edge case

Changes

  • last.go: Added length check and explicit panic with message "underscore.Last: empty slice"
  • Updated doc comment to document panic behavior

Testing

  • All existing tests pass including TestLastEmpty which validates panic behavior
  • Run: go test -v -run TestLast

Related

Resolves Issue 13 from ACTION_PLAN.md

🤖 Generated with Claude Code

- Add length check with explicit panic message
- Update documentation to note panic behavior
- Tests already exist and pass

Resolves Issue 13

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (d622c8c) to head (e3b85a1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #41   +/-   ##
=======================================
  Coverage   98.63%   98.64%           
=======================================
  Files          39       39           
  Lines         367      368    +1     
=======================================
+ Hits          362      363    +1     
  Misses          4        4           
  Partials        1        1           
Flag Coverage Δ
unittests 98.64% <100.00%> (+<0.01%) ⬆️

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.

@rjNemo rjNemo merged commit 2651a33 into main Nov 16, 2025
4 checks passed
rjNemo added a commit that referenced this pull request Nov 16, 2025
Document that Last panics on empty slices with a clear error message.
Add examples for single element and empty slice cases.

Related to Issue 13 (PR #41)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
rjNemo added a commit that referenced this pull request Nov 16, 2025
Document that Last panics on empty slices with a clear error message.
Add examples for single element and empty slice cases.

Related to Issue 13 (PR #41)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@rjNemo rjNemo deleted the fix/issue-13-last-edge-cases branch November 16, 2025 08:03
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