import { expect, it } from "vitest";
import { splitSql } from "./split-sql.js";

it("splits on semicolons outside quotes and comments", () => {
  expect(splitSql("SELECT ';' ; -- a; b\nSELECT 'it''s;'; /* x; */ SELECT `a;b`")).toEqual(["SELECT ';'", "SELECT 'it''s;'", "SELECT `a;b`"]);
});
it("handles DELIMITER blocks and escaped quotes", () => {
  expect(splitSql("DELIMITER $$\nBEGIN x; y; END$$\nDELIMITER ;\nSELECT 'a\\';b';")).toEqual(["BEGIN x; y; END", "SELECT 'a\\';b'"]);
});
