Skip to content
Snippets Groups Projects
Commit 62cf488e authored by Guillaume Grossetie's avatar Guillaume Grossetie :headphones:
Browse files

chore: simplify the format expected by inline tests and update docs

parent 0bb5da9c
No related branches found
No related tags found
1 merge request!29chore: simplify the format expected by inline tests
......@@ -90,13 +90,17 @@ The CLI must return an exit code of 0 on success and non-zero in case of failure
}
....
== Install
== Usage
Download the appropriate binary from the release page.
Releases are not available yet, but you can build from source by checking out the repo and running:
== Usage
[source,sh]
npm ci
npm run dist
Open a terminal and type:
Then open a terminal and type:
[source,sh]
asciidoc-tck-linux-x64 --adapter-command /path/to/impl
node harness/bin/asciidoc-tck.js cli --adapter-command /path/to/impl
NOTE: Requires `node` >= 20
......@@ -22,15 +22,11 @@ const testsSuite = async (testDir = ospath.join(PACKAGE_DIR, 'tests')) => {
describe('inline', function () {
const inlineTests = tests.find((it) => it.type === 'dir' && it.name === 'inline').entries
makeTests(inlineTests, async function ({ input, inputPath, expected, expectedWithoutLocations }) {
const actualRoot = await parse({
const actual = await parse({
contents: input,
path: inputPath,
type: 'inline',
})
assert.ok('blocks' in actualRoot, 'should have a blocks property')
assert.ok(actualRoot.blocks.length === 1, 'blocks property should have one (and only one) block')
assert.ok('inlines' in actualRoot.blocks[0], 'first block in blocks should have an inlines property')
const actual = actualRoot.blocks[0].inlines
if (expected == null) {
// Q: can we write data to expected file automatically?
// TODO only output expected if environment variable is set
......
......@@ -37,21 +37,6 @@ const readFromStdin = async () =>
const payload = JSON.parse(content)
const outputFile = ospath.join(payload.path.replace(/-input\.adoc$/, '-output.json'))
const expected = await fsp.readFile(outputFile, 'utf8')
let result = expected
if (payload.type === 'inline') {
const inlines = JSON.parse(expected)
result = JSON.stringify({
name: 'document',
type: 'block',
blocks: [
{
name: 'paragraph',
type: 'block',
inlines,
},
],
})
}
process.stdout.write(result)
process.stdout.write(expected)
await once(process.stdout.end(), 'close')
})()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment