Skip to content

test: comprehensive coverage for clone($ref, $depth)#134

Draft
Koan-Bot wants to merge 2 commits into
garu:masterfrom
Koan-Bot:koan.atoomic/test-depth-parameter
Draft

test: comprehensive coverage for clone($ref, $depth)#134
Koan-Bot wants to merge 2 commits into
garu:masterfrom
Koan-Bot:koan.atoomic/test-depth-parameter

Conversation

@Koan-Bot

@Koan-Bot Koan-Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

What

Adds t/28-depth-parameter.t with 36 tests covering the clone($ref, $depth) API.

Why

The depth parameter is a user-facing feature but had almost zero dedicated test
coverage — only 2 assertions in t/03-scalar.t (COW string refs at depth=2).
No tests verified the actual depth-limiting behavior: sharing vs cloning at
each level, interaction with blessed objects, circular refs, or mixed structures.

How

Tests are organized by depth value and structure type:

  • depth=0: verifies no-op semantics (same SV returned)
  • depth=1: shallow clone (inner refs shared, outer container cloned)
  • depth=2: two-level clone with arrays, hashes, and mixed nesting
  • depth=-1: default unlimited deep clone
  • blessed objects: class preserved at each depth boundary
  • circular refs: cycle handling with depth limits
  • scalar refs: confirms RV traversal doesn't consume a depth unit

Testing

All 36 tests pass on macOS system Perl. Full existing test suite unaffected.

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 228 insertions(+)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Koan-Bot and others added 2 commits May 1, 2026 07:50
The depth parameter controls how many container levels are deep-copied
vs shared.  Only 2 tests in t/03-scalar.t exercised it (and only for
COW string refs at depth=2).

New test file covers 36 cases across:
- depth=0 (no-op / same SV returned)
- depth=1 (shallow clone — inner refs shared)
- depth=2 (two-level clone — leaf refs shared)
- depth=-1 (default unlimited deep clone)
- mixed array/hash nesting
- blessed objects at various depths
- circular references with depth limits
- scalar references (RV traversal doesn't consume depth)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
install-with-cpm@v1 regressed on Perl 5.8-5.22 after a recent cpm
update requiring Perl 5.24+.  Bump to @v2 for action-based jobs
and use direct `cpm install` in the Docker-based Linux matrix
(where cpm is pre-installed).

Matches the approach approved by @atoomic in PR garu#120.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant