import { describe, expect, test } from "bun:test"; import { stripTomlComment } from "./manifests-text"; describe("stripTomlComment (INT-A10)", () => { test("strips trailing comments but not hashes inside strings", () => { expect(stripTomlComment('serde = "1.0" # json')).toBe('serde = "1.0" '); expect(stripTomlComment('name = "a#b" # c')).toBe('name = "a#b" '); expect(stripTomlComment("# whole line")).toBe(""); expect(stripTomlComment("plain = 1")).toBe("plain = 1"); }); test("a 2 MB line of whitespace is handled in linear time", () => { const line = " ".repeat(2 * 1024 * 1024); const started = performance.now(); expect(stripTomlComment(line)).toBe(line); expect(performance.now() - started).toBeLessThan(500); }); });