mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 04:50:52 +00:00
* feat: support Shift+Enter terminal newlines * fix: harden Shift+Enter terminal handling * fix: echo serial Shift+Enter newlines
23 lines
894 B
TypeScript
23 lines
894 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { formatSerialLocalEcho } from "./serialLocalEcho";
|
|
|
|
test("formatSerialLocalEcho echoes printable input and normalizes newlines", () => {
|
|
assert.equal(formatSerialLocalEcho("show version"), "show version");
|
|
assert.equal(formatSerialLocalEcho("\r"), "\r\n");
|
|
assert.equal(formatSerialLocalEcho("\n"), "\r\n");
|
|
assert.equal(formatSerialLocalEcho("\r\n"), "\r\n");
|
|
assert.equal(formatSerialLocalEcho("one\ntwo"), "one\r\ntwo");
|
|
});
|
|
|
|
test("formatSerialLocalEcho renders local editing control keys", () => {
|
|
assert.equal(formatSerialLocalEcho("\x7f"), "\b \b");
|
|
assert.equal(formatSerialLocalEcho("\b"), "\b \b");
|
|
assert.equal(formatSerialLocalEcho("\x03"), "^C");
|
|
});
|
|
|
|
test("formatSerialLocalEcho ignores single non-display control input", () => {
|
|
assert.equal(formatSerialLocalEcho("\x15"), "");
|
|
});
|