Push current progress so I can work on my laptop.
This commit is contained in:
7
test/basic.test.tce
Normal file
7
test/basic.test.tce
Normal 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
10
test/package.json
Normal 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
36
test/test-runner.test.js
Normal 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)
|
||||
})
|
||||
Reference in New Issue
Block a user