* Die Zeile, in der ein Ausdruck steht, aus der Datei gelesen. * * Uebernommen aus tools/smoke-w2b.mjs. Eine feste Zahl waere eine zweite * Wahrheit ueber das Fixture, die beim naechsten Zeilenumbruch still falsch * wird.
(source, needle, where)
| 235 | * wird. |
| 236 | */ |
| 237 | function lineContaining(source, needle, where) { |
| 238 | const index = source.split('\n').findIndex((line) => line.includes(needle)); |
| 239 | if (index < 0) { |
| 240 | throw new Error(`"${needle}" steht nicht in ${where}`); |
| 241 | } |
| 242 | return index + 1; |
| 243 | } |
| 244 | |
| 245 | async function main() { |
| 246 | const totalStarted = Date.now(); |