Start working on tests.
This commit is contained in:
23
packages/js/test/index.js
Normal file
23
packages/js/test/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createLineData, parseLine, useDocument } from '@terrace/core'
|
||||
import { createStdinReader } from '@terrace/core/readers/node-readline'
|
||||
|
||||
const testName = process.argv[2]
|
||||
|
||||
|
||||
const tests = {
|
||||
'linedata:basic': async () => {
|
||||
const { level, line, head, tail, next } = useDocument(createStdinReader())
|
||||
while(await next()) {
|
||||
console.log(`level: ${level()} | head: ${head()} | tail: ${tail()} | line: ${line()}`)
|
||||
}
|
||||
},
|
||||
'linedata:tabs': async () => {
|
||||
const { level, line, head, tail, next } = useDocument(createStdinReader(), '\t')
|
||||
while(await next()) {
|
||||
console.log(`level: ${level()} | head: ${head()} | tail: ${tail()} | line: ${line()}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const test = tests[testName]
|
||||
await test()
|
||||
Reference in New Issue
Block a user