testPatchSaysWhereAsTheViewNumbers

tcmts.cli.main.testPatchSaysWhereAsTheViewNumbers · #6upx5qkd · term

import { applyPatch } from "#codebase/tcmts/cli/main";
import assert from "node:assert/strict";

export const testPatchSaysWhereAsTheViewNumbers = () => {
  // a line it isn't on, said as the view numbers it (`from`: the view's line of the text's first, less one)
  const r = applyPatch(
    "// tcm: namespace m\nexport const f = 1;\n",
    [{ old: "const f = 2", new: "" }],
    false,
    -1,
  );
  assert.match("problem" in r ? r.problem : "", /the nearest line is 1: "export const f = 1;"/);
}

uses