Push current progress so I can work on my laptop.

This commit is contained in:
Joshua Bemenderfer
2023-02-05 07:44:11 -05:00
parent 94767772b4
commit 657c95a4c1
28 changed files with 2372 additions and 3468 deletions

7
test/basic.test.tce Normal file
View File

@@ -0,0 +1,7 @@
#schema test
input
key value
output
level: 0 | head: key | tail: value | line: key value

10
test/package.json Normal file
View File

@@ -0,0 +1,10 @@
{
"name": "@terrace/test",
"type": "module",
"scripts": {
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
},
"dependencies": {
"@terrace/core": "workspace:*"
}
}

36
test/test-runner.test.js Normal file
View File

@@ -0,0 +1,36 @@
import { expect } from 'chai'
import fs from 'node:fs/promises'
import { useDocument } from '@terrace/core'
import { createReadlineReader } from '@terrace/core/readers/node-readline'
async function loadTest(path) {
const { next, level, head, tail, line, match } = useDocument(createReadlineReader(path))
const test = { input: [], output: [] }
while (await next()) {
if (match('input')) {
const rootLevel = level()
while (await next(rootLevel)) {
test.input.push(line(rootLevel))
}
}
if (match('output')) {
const rootLevel = level()
while (await next(rootLevel)) {
test.input.push(line(rootLevel))
}
}
}
return { input: test.input.join('\n'), output: test.output.join('\n') }
}
it('Runs a basic test', async () => {
const { input, output } = await loadTest('./basic.test.tce', 'utf-8')
console.log(input)
expect(1).to.equal(1)
})