import { describe, expect, test } from "bun:test" import { matchLine, matchOutput } from "./match.ts" describe("matchLine", () => { test("exact match", () => { expect(matchLine("hello", "hello")).toBe(true) }) test("exact mismatch", () => { expect(matchLine("hello", "world")).toBe(false) }) test("inline wildcard", () => { expect(matchLine("draft 1 (v...)", "draft 1 (v2)")).toBe(true) expect(matchLine("draft 1 (v...)", "draft 1 (v123)")).toBe(true) }) test("wildcard at start", () => { expect(matchLine("...world", "hello world")).toBe(true) }) test("wildcard at end", () => { expect(matchLine("hello...", "hello world")).toBe(true) }) test("multiple inline wildcards", () => { expect(matchLine("a...b...c", "aXXbYYc")).toBe(true) }) }) describe("matchOutput", () => { test("exact match", () => { expect(matchOutput(["hello"], ["hello"])).toBe(true) }) test("mismatch", () => { expect(matchOutput(["hello"], ["world"])).toBe(false) }) test("multiline wildcard matches zero lines", () => { expect(matchOutput(["...", "end"], ["end"])).toBe(true) }) test("multiline wildcard matches multiple lines", () => { expect(matchOutput(["...", "end"], ["a", "b", "end"])).toBe(true) }) test("multiline wildcard at end", () => { expect(matchOutput(["start", "..."], ["start", "a", "b"])).toBe(true) }) test("multiline wildcard in middle", () => { expect( matchOutput(["first", "...", "last"], ["first", "a", "b", "last"]), ).toBe(true) }) test("empty expected matches empty actual", () => { expect(matchOutput([], [])).toBe(true) }) test("empty expected does not match non-empty actual", () => { expect(matchOutput([], ["something"])).toBe(false) }) test("multiline wildcard alone matches anything", () => { expect(matchOutput(["..."], ["a", "b", "c"])).toBe(true) expect(matchOutput(["..."], [])).toBe(true) }) })