mirror of
https://github.com/antirez/linenoise.git
synced 2026-02-04 04:41:38 +00:00
Add test framework with VT100 terminal emulator
Implement comprehensive test suite for linenoise: VT100 Terminal Emulator: - Column-based UTF-8 representation with display width tracking - Each screen cell stores complete UTF-8 characters (up to 32 bytes) - Proper handling of wide characters (emoji, CJK) as 2-column cells - ZWJ tracking for grapheme cluster storage - Escape sequence parsing for cursor movement and screen clearing Test Harness: - Fork/pipe architecture for testing via LINENOISE_ASSUME_TTY - Visual rendering to real terminal for debugging failed tests - Assertion helpers for screen content and cursor position Test Coverage (72 tests): - Basic typing and cursor movement - UTF-8 input and navigation (é, 中, 🎉) - Emoji cursor movement and deletion - Grapheme clusters (heart+VS, thumbs up+skin tone, rainbow flag) - Horizontal scrolling with long lines - Horizontal scrolling with UTF-8 content - Multiline mode basics - Multiline history navigation (regression test) - Word/line deletion (Ctrl-W, Ctrl-U) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
8
Makefile
8
Makefile
@@ -3,5 +3,11 @@ linenoise_example: linenoise.h linenoise.c
|
|||||||
linenoise_example: linenoise.c example.c
|
linenoise_example: linenoise.c example.c
|
||||||
$(CC) -Wall -W -Os -g -o linenoise_example linenoise.c example.c
|
$(CC) -Wall -W -Os -g -o linenoise_example linenoise.c example.c
|
||||||
|
|
||||||
|
linenoise-test: linenoise-test.c linenoise_example
|
||||||
|
$(CC) -Wall -W -Os -g -o linenoise-test linenoise-test.c
|
||||||
|
|
||||||
|
test: linenoise-test linenoise_example
|
||||||
|
./linenoise-test
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f linenoise_example
|
rm -f linenoise_example linenoise-test
|
||||||
|
|||||||
1284
linenoise-test.c
Normal file
1284
linenoise-test.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user