MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseExpected

Function parseExpected

packages/tools/doctest/src/Transform.ts:122–128  ·  view source on GitHub ↗
(expected: string, source: string, offset: number, file: string, line: number)

Source from the content-addressed store, hash-verified

120}
121
122const parseExpected = (expected: string, source: string, offset: number, file: string, line: number): void => {
123 const parsed = parseSync(`${file}?doctest-expected`, `const __expected = (${expected})`, { lang: "ts" })
124 const error = parsed.errors[0]
125 if (error !== undefined) {
126 fail(source, offset, file, line, `invalid doctest expected expression: ${error.message}`)
127 }
128}
129
130/**
131 * Transforms trailing doctest assertion comments into executable assertions.

Callers 1

transformFunction · 0.85

Calls 1

failFunction · 0.70

Tested by

no test coverage detected