MCPcopy Index your code
hub / github.com/EvolvingPrograms/turing / loadTestFile

Function loadTestFile

src/utils.ts:21–34  ·  view source on GitHub ↗
(id: string, file: string)

Source from the content-addressed store, hash-verified

19}
20
21export const loadTestFile = async (id: string, file: string): Promise<any> => {
22 const path = resolve("programs", id, file);
23 const contents = (await readFile(path, "utf-8")).trim();
24
25 if (file.endsWith(".ts")) {
26 return await import(path);
27 } else if (file.endsWith(".jsonl")) {
28 return contents.split("\n").map((line) => JSON.parse(line));
29 } else if (file.endsWith(".json")) {
30 return JSON.parse(contents);
31 }
32
33 return contents;
34};
35
36export function reduce(xs: Value[]): [Value[], number] {
37 let ys: Value[] = [];

Callers 1

test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected