{"draft":null,"from":165,"to":166,"files":[{"path":"src/engine/test/projection-reader.test.ts","added":24,"removed":0,"diff":"--- a/src/engine/test/projection-reader.test.ts\n+++ b/src/engine/test/projection-reader.test.ts\n@@ -10,6 +10,30 @@\n import { Repo } from \"./helpers.ts\";\n import { SqlState } from \"./storage-helper.ts\";\n \n+test(\"projected text streams lines and line lookup does not read file text\", (t) => {\n+\tconst storage = new SqlState();\n+\tt.after(() => storage.db.close());\n+\tconst text = `${\"x\".repeat(40000)}\\nsecond\\nthird\\n`;\n+\tconst repo = Repo.init({ \"f.txt\": text, \"empty.txt\": \"\" });\n+\tconst graph = new Graph({ storage: new CachedStateStorage(storage) });\n+\tgraph.add(repo.graph.atom(\"a0\"));\n+\tconst adapter = new ExperimentalMarkerProjection(storage, graph, \"f.txt\", \"streamed-text\");\n+\tconst state = adapter.apply(adapter.empty(), graph.atom(\"a0\"));\n+\tconst reader = new ProjectionReader(adapter, state, () => {});\n+\tt.mock.method(reader, \"lines\", () => {\n+\t\tthrow Error(\"full line array forbidden\");\n+\t});\n+\tassert.equal(reader.text(\"f.txt\"), text);\n+\tassert.equal(reader.text(\"empty.txt\"), \"\");\n+\tassert.equal(reader.text(\"missing.txt\"), \"\");\n+\tconst ids = [...adapter.lineIds(state, \"f.txt\")];\n+\tt.mock.method(graph, \"textOf\", () => {\n+\t\tthrow Error(\"line lookup must not read text\");\n+\t});\n+\tfor (let i = 0; i < ids.length; i++) assert.equal(reader.lineNumber(\"f.txt\", ids[i]!), i);\n+\tassert.equal(reader.lineNumber(\"f.txt\", \"missing\"), -1);\n+});\n+\n test(\"unchanged atom builder consumes the private reader for replacement and insertion edits\", () => {\n \tconst storage = new SqlState();\n \ttry {"}],"unmatched":[]}