14
codex-cli/tests/text-buffer-crlf.test.ts
Normal file
14
codex-cli/tests/text-buffer-crlf.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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("");
|
||||
|
||||
// Windows‑style CRLF
|
||||
buf.insertStr("ab\r\ncd\r\nef");
|
||||
|
||||
expect(buf.getLines()).toEqual(["ab", "cd", "ef"]);
|
||||
expect(buf.getCursor()).toEqual([2, 2]); // after 'f'
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user