import { describe, expect, it } from "vitest"; import { expectChannelInboundContextContract as expectInboundContextContract } from "../../channels/plugins/contracts/test-helpers.js"; import type { MsgContext } from "../templating.js"; import { finalizeInboundContext } from "./inbound-context.js"; import { normalizeInboundTextNewlines } from "./inbound-text.js";
describe("normalizeInboundTextNewlines", () => {
it("normalizes real newlines and preserves literal backslash-n sequences", () => { const cases = [
{ input: "hello\r\nworld", expected: "hello\nworld" },
{ input: "hello\rworld", expected: "hello\nworld" },
{ input: "C:\\Work\\nxxx\\README.md", expected: "C:\\Work\\nxxx\\README.md" },
{
input: "Please read the file at C:\\Work\\nxxx\\README.md",
expected: "Please read the file at C:\\Work\\nxxx\\README.md",
},
{ input: "C:\\new\\notes\\nested", expected: "C:\\new\\notes\\nested" },
{ input: "Line 1\r\nC:\\Work\\nxxx", expected: "Line 1\nC:\\Work\\nxxx" },
] as const;
for (const testCase of cases) {
expect(normalizeInboundTextNewlines(testCase.input)).toBe(testCase.expected);
}
});
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.