Files
llmx/codex-cli/tests/text-buffer-crlf.test.ts
Ilan Bigio 59a180ddec Initial commit
Signed-off-by: Ilan Bigio <ilan@openai.com>
2025-04-16 12:56:08 -04:00

15 lines
448 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import TextBuffer from "../src/lib/text-buffer.js";
import { describe, it, expect } from "vitest";
describe("TextBuffer newline normalisation", () => {
it("insertStr should split on \r and \r\n sequences", () => {
const buf = new TextBuffer("");
// Windowsstyle CRLF
buf.insertStr("ab\r\ncd\r\nef");
expect(buf.getLines()).toEqual(["ab", "cd", "ef"]);
expect(buf.getCursor()).toEqual([2, 2]); // after 'f'
});
});