// The editor's port reads every line in time linear in its length // (Fable round 3, L8, and round 2's M1): the shapes that made it // quadratic each read in well under the bound here. import { test } from 'node:test' import assert from 'node:assert/strict' import { spans } from './markup.mjs' const shapes = { 'image openers': '![a'.repeat(40000) + '](z)', 'shared link address': '[x]('.repeat(25000) + 'a)', 'shared web address': '[x](http://e.com/'.repeat(25000) + 'a)' } for (const [name, text] of Object.entries(shapes)) { test(`a line of ${name} reads in linear time`, () => { const started = performance.now() spans(text) const took = performance.now() - started assert.ok(took < 2000, `${name} took ${Math.round(took)} ms`) }) }