Skip to content

Add comprehensive e2e tests for --max-chars output truncation#158

Merged
jancurn merged 1 commit intomainfrom
claude/add-e2e-max-chars-tests-FGog4
Apr 10, 2026
Merged

Add comprehensive e2e tests for --max-chars output truncation#158
jancurn merged 1 commit intomainfrom
claude/add-e2e-max-chars-tests-FGog4

Conversation

@jancurn
Copy link
Copy Markdown
Member

@jancurn jancurn commented Apr 10, 2026

Summary

This PR adds a comprehensive end-to-end test suite for the --max-chars option, which controls output truncation in human-readable mode while being ignored in JSON mode.

Key Changes

  • New test file: test/e2e/suites/basic/max-chars.test.sh with 192 lines of test coverage
  • Test coverage includes:
    • Output truncation behavior for tools-call, tools-list, resources-list, resources-read, prompts-list, and prompts-get commands
    • Verification that truncation messages display correctly with character counts and size indicators (chars/KB)
    • Confirmation that --max-chars is properly ignored when using --json mode
    • Input validation tests for invalid values (zero, negative, non-numeric)
    • Edge cases like small vs. large output and small vs. large --max-chars values

Notable Implementation Details

  • Tests verify both truncation behavior (output is cut off) and user feedback (truncation notice is displayed)
  • Tests confirm that JSON output is never truncated regardless of --max-chars setting
  • Comprehensive validation testing ensures the option rejects invalid inputs with appropriate error messages
  • Tests use the existing test framework (framework.sh) and follow established patterns for session management and assertions

https://claude.ai/code/session_01ExKTHAP8ADz2QfXi1vYh5p

Tests cover truncation across all command types (tools-call, tools-list,
resources-list, resources-read, prompts-list, prompts-get), JSON mode
bypass, truncation notice formatting (KB vs chars), and input validation.

https://claude.ai/code/session_01ExKTHAP8ADz2QfXi1vYh5p
@jancurn jancurn merged commit d1479d1 into main Apr 10, 2026
6 checks passed
@jancurn jancurn deleted the claude/add-e2e-max-chars-tests-FGog4 branch April 10, 2026 14:31
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.

3 participants