diff options
| author | copilot-swe-agent[bot] <[email protected]> | 2025-11-14 08:36:12 +0000 |
|---|---|---|
| committer | copilot-swe-agent[bot] <[email protected]> | 2025-11-14 08:36:12 +0000 |
| commit | ea4f75a68465992c68779fc0cc4ea3ef251af05e (patch) | |
| tree | fa8104a0377e3f7810953301803bfc0bfcba35be /lib/error_test.go | |
| parent | be5f580e8bfb9169bb8b410d1e154057e9ac1ed5 (diff) | |
Add comprehensive unit tests for lib package with 90.3% coveragecopilot/add-unit-tests-for-lib-package
Co-authored-by: Loyalsoldier <[email protected]>
Diffstat (limited to 'lib/error_test.go')
| -rw-r--r-- | lib/error_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/error_test.go b/lib/error_test.go new file mode 100644 index 00000000..d73b1ec8 --- /dev/null +++ b/lib/error_test.go @@ -0,0 +1,36 @@ +package lib + +import ( + "errors" + "testing" +) + +func TestErrors(t *testing.T) { + tests := []struct { + name string + err error + }{ + {"ErrDuplicatedConverter", ErrDuplicatedConverter}, + {"ErrUnknownAction", ErrUnknownAction}, + {"ErrNotSupportedFormat", ErrNotSupportedFormat}, + {"ErrInvalidIPType", ErrInvalidIPType}, + {"ErrInvalidIP", ErrInvalidIP}, + {"ErrInvalidIPLength", ErrInvalidIPLength}, + {"ErrInvalidIPNet", ErrInvalidIPNet}, + {"ErrInvalidCIDR", ErrInvalidCIDR}, + {"ErrInvalidPrefix", ErrInvalidPrefix}, + {"ErrInvalidPrefixType", ErrInvalidPrefixType}, + {"ErrCommentLine", ErrCommentLine}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if tt.err == nil { + t.Errorf("%s should not be nil", tt.name) + } + if !errors.Is(tt.err, tt.err) { + t.Errorf("%s should match itself", tt.name) + } + }) + } +} |
