1
0
Fork
You've already forked nice
0

Improve case coverage #8

Merged
antonyho merged 2 commits from handle-edge-case into master 2025年06月17日 15:03:18 +02:00
antonyho commented 2025年06月17日 15:01:51 +02:00 (Migrated from github.com)
Copy link

Handle error in general when no parameter was passed to Tackle().

Handle error in general when no parameter was passed to `Tackle()`.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025年06月17日 15:02:04 +02:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment
Copy link

Pull Request Overview

This PR adds error handling for cases when no parameter is passed to Tackle() and makes minor adjustments in test descriptions. Key changes include:

  • Fixing typos in test case names.
  • Adding a new test case to verify behavior when no targets are provided.
  • Updating Tackle() in nice.go to return a default generic error handler when targets is empty.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tackle_test.go Adjusted test case names and added a new test for empty targets.
nice.go Added handling for no targets by returning a generic error type.
Comments suppressed due to low confidence (2)

tackle_test.go:63

  • [nitpick] Consider renaming the test case "No artefact type" to "No targets passed" for improved clarity on what is being tested.
	t.Run("No artefact type", func(t *testing.T) {

nice.go:54

  • Clarify the comment to explicitly state that when no targets are provided, Tackle() returns a Handler with a generic error handler registered via reflect.TypeForerror.
// Not passing any parameter to targets will assume generic error
## Pull Request Overview This PR adds error handling for cases when no parameter is passed to Tackle() and makes minor adjustments in test descriptions. Key changes include: - Fixing typos in test case names. - Adding a new test case to verify behavior when no targets are provided. - Updating Tackle() in nice.go to return a default generic error handler when targets is empty. ### Reviewed Changes Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments. | File | Description | | --------------- | --------------------------------------------------------------- | | tackle_test.go | Adjusted test case names and added a new test for empty targets. | | nice.go | Added handling for no targets by returning a generic error type. | <details> <summary>Comments suppressed due to low confidence (2)</summary> **tackle_test.go:63** * [nitpick] Consider renaming the test case "No artefact type" to "No targets passed" for improved clarity on what is being tested. ``` t.Run("No artefact type", func(t *testing.T) { ``` **nice.go:54** * Clarify the comment to explicitly state that when no targets are provided, Tackle() returns a Handler with a generic error handler registered via reflect.TypeFor[error](). ``` // Not passing any parameter to targets will assume generic error ``` </details>
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
antonyho/nice!8
Reference in a new issue
antonyho/nice
No description provided.
Delete branch "handle-edge-case"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?