Skip to content

tests: More test cases for input parser edge cases - #1005

Merged
gdamore merged 1 commit into
mainfrom
more-input-coverage
Jan 15, 2026
Merged

gdamore merged 1 commit into
mainfrom
more-input-coverage

Conversation

@gdamore

@gdamore gdamore commented Jan 15, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for keyboard input handling with additional test cases for special key sequences, modifier combinations, and edge cases to improve reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 15, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request extends the terminal input test suite by adding new test vectors to input_test.go. Changes include additional test cases for special key sequences (Esc modifiers, Home variants, Win modifiers) and ignored sequences (SoS-Embed-ESC, RuntDA1, RuntWindowNotice, OtherIntermediates).

Changes

Cohort / File(s) Summary
Test Coverage Expansion
input_test.go
Added new test vectors to TestSpecialKeys including Esc-Ctrl-B, Esc-[, Home, Ctrl-Home, and Win-Ctrl-1 sequences. Extended TestIgnoredSequences with SoS-Embed-ESC, RuntDA1, RuntWindowNotice, and OtherIntermediates test cases.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 Hops through sequences, one test at a time,
Esc and Home and modifiers align,
Win-Ctrl dances with keystrokes so fine,
Each vector a promise, each case by design! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding more test cases for edge cases in the input parser, which is directly reflected in the test expansions shown in the summary.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4583be3 and 549f347.

📒 Files selected for processing (1)
  • input_test.go
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-06T15:44:36.396Z
Learnt from: gdamore
Repo: gdamore/tcell PR: 977
File: vt/emulate.go:150-150
Timestamp: 2026-01-06T15:44:36.396Z
Learning: In vt/emulate.go for DEC Private Mode 2 (PmVT52), the VT200/VT52 semantics are inverted: when the mode is OFF, VT52 mode is enabled; when the mode is ON, VT52 is disabled and VT100/ANSI mode is active. Ensure reviews verify that ModeOnLocked correctly enforces VT100/ANSI (VT52 disabled) when set, and that enabling OFF path activates VT52 mode. Document this inversion in code comments and tests, and avoid assuming a direct one-way mapping between PmVT52 and VT52 state. If any code branches rely on the opposite behavior, adjust tests accordingly.

Applied to files:

  • input_test.go
🔇 Additional comments (5)
input_test.go (5)

538-539: LGTM!

Good edge case coverage for Alt-modified keys. The Esc-[ test case correctly validates the timeout behavior when CSI introducer isn't followed by additional input, and Esc-Ctrl-B properly tests combined Alt+Ctrl modifiers.


581-581: LGTM!

Standard xterm encoding for Ctrl+Home (CSI 1;5~) is correctly tested.


596-596: LGTM!

Good addition testing Windows Terminal input format for Ctrl+digit key combinations, complementing the existing Win-Ctrl-* test cases.


723-723: LGTM!

Good edge case testing embedded ESC within SoS data that shouldn't terminate the sequence prematurely.


745-747: LGTM!

Valuable robustness tests for malformed sequences:

  • RuntDA1 and RuntWindowNotice test incomplete CSI sequences missing required parameters
  • OtherIntermediates tests CSI with space intermediate byte, which should be ignored as it's not a recognized key sequence

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jan 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.43%. Comparing base (4583be3) to head (549f347).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1005      +/-   ##
==========================================
+ Coverage   84.13%   84.43%   +0.29%     
==========================================
  Files          43       43              
  Lines        4382     4382              
==========================================
+ Hits         3687     3700      +13     
+ Misses        539      531       -8     
+ Partials      156      151       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gdamore
gdamore merged commit 549f347 into main Jan 15, 2026
15 checks passed
@gdamore
gdamore deleted the more-input-coverage branch January 15, 2026 04:15

This branch was previously deployed

1 inactive deployment
github-pages — 549f3475 Deployed Jan 15, 2026 by gdamore via deploy #334
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