deno
a065ffd8 - chore(test): verify prompt() round-trips Unicode characters (#34482)

Commit
190 days ago
chore(test): verify prompt() round-trips Unicode characters (#34482) ## Summary Extends the existing prompt PTY test (`_066_prompt`) with a case that types Polish characters and an emoji (`"Hello! Δ…ΕΌΔ‡ πŸ¦•"`) and asserts that the returned string's UTF-8 bytes match the expected encoding. This catches regressions in the path that broke prompt() on Windows in #21534. Before #21893 (Jan 2024), `prompt()` read user input via `stdin.readSync()`, which on Windows calls `ReadFile` on the console handle β€” `ReadFile` returns bytes in the console input code page, so non-ASCII characters got transliterated or replaced. The active code routes `prompt()` through `op_read_line_prompt`, which uses rustyline; on Windows rustyline reads input via `ReadConsoleInputW` (UTF-16) and on Unix via the UTF-8 byte stream, so the returned string preserves the user's input verbatim regardless of the console code page. The πŸ¦• character is also a surrogate pair on Windows (U+1F995 splits into `0xD83E 0xDD95`), which exercises rustyline's surrogate-pair joining path. Note: the PTY harness skips Windows CI (`Pty::is_supported()` returns `false` there), so this is primarily a Linux/macOS regression test for the rustyline integration; the Windows-specific UTF-16 reader is exercised through the same shared code path. Refs #21534. Closes denoland/orchid#285. ## Test plan - [x] Reproduced the expected behavior locally with stable Deno 2.7.14 driven by a Python `pty.fork()` harness β€” the bytes printed for the Polish-and-emoji string match the asserted sequence `72,101,108,108,111,33,32,196,133,197,188,196,135,32,240,159,166,149`. - [ ] CI runs the updated `_066_prompt` test on Linux/macOS. Co-authored-by: divybot <divybot@users.noreply.github.com> Co-authored-by: Divy Srivastava <me@littledivy.com>
Author
Parents
Loading