- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/worker/project/test/move-line-text.test.ts?version=296&format=json
29 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 175, 1 version changed it
You're reading version 296. The newest is 318, and no version since then changed this file.
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { Graph } from "../../../src/engine/graph.ts";
4import { StoredText } from "../../../src/engine/stored-text.ts";
5import { Repo } from "../../../src/engine/test/helpers.ts";
6import { SqlState } from "../../../src/engine/test/storage-helper.ts";
7import { MoveLineText } from "../move-line-text.ts";
9test("move text symbols compare stored chunks exactly and distinguish hash collisions", (t) => {
10 const storage = new SqlState();
11 t.after(() => storage.db.close());
12 const long = "x".repeat(100000);
13 const repo = Repo.init({ f: `reqicjpk\nejfslztg\n${long}\n${long}\n {};\n` });
14 const graph = new Graph({ storage });
15 graph.add(repo.graph.atom("a0"));
16 t.mock.method(StoredText.prototype, "read", () => {
17 throw Error("whole text forbidden");
18 });
19 const texts = new MoveLineText(graph);
20 assert.notEqual(texts.intern("a0.0"), texts.intern("a0.1"));
21 assert.equal(texts.intern("a0.2"), texts.intern("a0.3"));
22 assert.equal(texts.plain[texts.intern("a0.2")], false);
23 assert.equal(texts.plain[texts.intern("a0.4")], true);
24 const known = texts.intern("a0.2");
25 t.mock.method(graph, "textChunks", () => {
26 throw Error("known identity must not reread text");
27 });
28 assert.equal(texts.intern("a0.2"), known);
29});