From cb21984c988380aa157e76377469dbb8d28e7e2b Mon Sep 17 00:00:00 2001 From: Varun Chawla Date: Fri, 13 Feb 2026 00:48:33 -0800 Subject: [PATCH] Add test for nil Len() behavior The nil check in Len() was added in PR #95 but lacked test coverage. This adds TestLenNil to verify that calling Len() on a nil *Error returns 0 instead of panicking. Fixes #54 --- sort_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sort_test.go b/sort_test.go index 3f8aede..45e65fc 100644 --- a/sort_test.go +++ b/sort_test.go @@ -53,3 +53,10 @@ func TestSortMultiple(t *testing.T) { t.Fatalf("bad: %#v", err) } } + +func TestLenNil(t *testing.T) { + var err *Error + if err.Len() != 0 { + t.Fatalf("expected Len() to return 0 for nil *Error, got %d", err.Len()) + } +}