Skip to content

Commit e064c3a

Browse files
committed
test: add implementation-independent oracle for --json-input --max-depth
The existing assertion derives the expected output from the same pipeline the production code runs, so a correlated off-by-one in the depth predicate would pass undetected. Pin the depth boundary by asserting which node names are present and absent, independently of that pipeline. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
1 parent 12d6fed commit e064c3a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/json.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ fn json_input_max_depth() {
239239
// The truncation must actually drop the deeper levels of the tree.
240240
let untruncated = visualize(&apply_pipeline(sample_tree(), u64::MAX, 0.0, false));
241241
assert_ne!(expected, untruncated);
242+
243+
// Implementation-independent oracle: with two levels, the root's direct
244+
// children appear while their descendants do not. This pins the depth
245+
// boundary without reusing the pipeline that produces `expected`.
246+
assert!(actual.contains("foo"));
247+
assert!(!actual.contains("subdirectory with a really long name"));
242248
}
243249

244250
#[test]

0 commit comments

Comments
 (0)