From 604ef04d6d1fce2efac5245d37be3208f6723fec Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 05:12:04 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20[Testing=20Improvement]=20Add=20?= =?UTF-8?q?ArrayList=20clear=20and=20pop=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses an untested gap in `ArrayList.pop` functionality where popping from a logically empty list (after calling `clear`) was not explicitly verified to return `null`. 🎯 **What:** Appends a test to `echo-core-zig/src/data/arraylist.zig` to verify popping from an emptied list. 📊 **Coverage:** The new `test "ArrayList clear and pop"` scenario verifies that `ArrayList.clear()` adequately sets length to 0, which successfully enables `ArrayList.pop()` to return `null`. ✨ **Result:** Test coverage for `ArrayList` improved. Co-authored-by: ulac000000 <132948319+ulac000000@users.noreply.github.com> --- echo-core-zig/src/data/arraylist.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/echo-core-zig/src/data/arraylist.zig b/echo-core-zig/src/data/arraylist.zig index 80a3f42..58fe487 100644 --- a/echo-core-zig/src/data/arraylist.zig +++ b/echo-core-zig/src/data/arraylist.zig @@ -109,3 +109,13 @@ test "ArrayList get out of bounds" { try std.testing.expectEqual(@as(?*const i32, null), list.get(1)); try std.testing.expectEqual(@as(?*const i32, null), list.get(100)); } + +test "ArrayList clear and pop" { + var list = ArrayList(i32).init(std.testing.allocator); + defer list.deinit(); + + try list.append(1); + list.clear(); + + try std.testing.expectEqual(@as(?i32, null), list.pop()); +}