Fix obvious bug.
This commit is contained in:
parent
657c95a4c1
commit
ea6eb7bd94
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/experiments/
|
/experiments/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
.turbo
|
@ -110,10 +110,10 @@ async function main() {
|
|||||||
if (match('name')) author.name = tail().trim()
|
if (match('name')) author.name = tail().trim()
|
||||||
else if (match('email')) author.email = tail().trim()
|
else if (match('email')) author.email = tail().trim()
|
||||||
else {
|
else {
|
||||||
if (!author['#text']) author['#text'] = [level(), line(l + 1)]
|
if (!author['#text']) author['#text'] = [line(l + 1)]
|
||||||
// Loop through all remaining lines to avoid re-matching name or email above.
|
// Loop through all remaining lines to avoid re-matching name or email above.
|
||||||
while(await next(l)) {
|
while(await next(l)) {
|
||||||
author['#text'].push(level(), line(l + 1))
|
author['#text'].push(line(l + 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
102
pnpm-lock.yaml
generated
102
pnpm-lock.yaml
generated
@ -12,20 +12,6 @@ importers:
|
|||||||
jest: 29.4.1
|
jest: 29.4.1
|
||||||
turbo: 1.7.3
|
turbo: 1.7.3
|
||||||
|
|
||||||
experiments/lesson-plans:
|
|
||||||
specifiers:
|
|
||||||
'@terrace/core': workspace:*
|
|
||||||
ejs: ^3.1.8
|
|
||||||
humanize-duration: ^3.27.3
|
|
||||||
nunjucks: ^3.2.3
|
|
||||||
parse-duration: ^1.0.2
|
|
||||||
dependencies:
|
|
||||||
'@terrace/core': link:../../packages/js/core
|
|
||||||
ejs: 3.1.8
|
|
||||||
humanize-duration: 3.28.0
|
|
||||||
nunjucks: 3.2.3
|
|
||||||
parse-duration: 1.0.2
|
|
||||||
|
|
||||||
packages/js/core:
|
packages/js/core:
|
||||||
specifiers:
|
specifiers:
|
||||||
vite: ^3.2.3
|
vite: ^3.2.3
|
||||||
@ -766,10 +752,6 @@ packages:
|
|||||||
'@types/yargs-parser': 21.0.0
|
'@types/yargs-parser': 21.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/a-sync-waterfall/1.0.1:
|
|
||||||
resolution: {integrity: sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/acorn/8.8.2:
|
/acorn/8.8.2:
|
||||||
resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==}
|
resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==}
|
||||||
engines: {node: '>=0.4.0'}
|
engines: {node: '>=0.4.0'}
|
||||||
@ -800,6 +782,7 @@ packages:
|
|||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dependencies:
|
dependencies:
|
||||||
color-convert: 2.0.1
|
color-convert: 2.0.1
|
||||||
|
dev: true
|
||||||
|
|
||||||
/ansi-styles/5.2.0:
|
/ansi-styles/5.2.0:
|
||||||
resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
|
resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
|
||||||
@ -820,18 +803,10 @@ packages:
|
|||||||
sprintf-js: 1.0.3
|
sprintf-js: 1.0.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/asap/2.0.6:
|
|
||||||
resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/assertion-error/1.1.0:
|
/assertion-error/1.1.0:
|
||||||
resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==}
|
resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/async/3.2.4:
|
|
||||||
resolution: {integrity: sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/babel-jest/29.4.1_@babel+core@7.20.12:
|
/babel-jest/29.4.1_@babel+core@7.20.12:
|
||||||
resolution: {integrity: sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==}
|
resolution: {integrity: sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==}
|
||||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||||
@ -906,18 +881,14 @@ packages:
|
|||||||
|
|
||||||
/balanced-match/1.0.2:
|
/balanced-match/1.0.2:
|
||||||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/brace-expansion/1.1.11:
|
/brace-expansion/1.1.11:
|
||||||
resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==}
|
resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
balanced-match: 1.0.2
|
balanced-match: 1.0.2
|
||||||
concat-map: 0.0.1
|
concat-map: 0.0.1
|
||||||
|
dev: true
|
||||||
/brace-expansion/2.0.1:
|
|
||||||
resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==}
|
|
||||||
dependencies:
|
|
||||||
balanced-match: 1.0.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/braces/3.0.2:
|
/braces/3.0.2:
|
||||||
resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==}
|
resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==}
|
||||||
@ -994,6 +965,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
ansi-styles: 4.3.0
|
ansi-styles: 4.3.0
|
||||||
supports-color: 7.2.0
|
supports-color: 7.2.0
|
||||||
|
dev: true
|
||||||
|
|
||||||
/char-regex/1.0.2:
|
/char-regex/1.0.2:
|
||||||
resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==}
|
resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==}
|
||||||
@ -1042,6 +1014,7 @@ packages:
|
|||||||
engines: {node: '>=7.0.0'}
|
engines: {node: '>=7.0.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
color-name: 1.1.4
|
color-name: 1.1.4
|
||||||
|
dev: true
|
||||||
|
|
||||||
/color-name/1.1.3:
|
/color-name/1.1.3:
|
||||||
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==}
|
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==}
|
||||||
@ -1049,14 +1022,11 @@ packages:
|
|||||||
|
|
||||||
/color-name/1.1.4:
|
/color-name/1.1.4:
|
||||||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
||||||
|
dev: true
|
||||||
/commander/5.1.0:
|
|
||||||
resolution: {integrity: sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==}
|
|
||||||
engines: {node: '>= 6'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/concat-map/0.0.1:
|
/concat-map/0.0.1:
|
||||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/convert-source-map/1.9.0:
|
/convert-source-map/1.9.0:
|
||||||
resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==}
|
resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==}
|
||||||
@ -1113,14 +1083,6 @@ packages:
|
|||||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ejs/3.1.8:
|
|
||||||
resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
jake: 10.8.5
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/electron-to-chromium/1.4.286:
|
/electron-to-chromium/1.4.286:
|
||||||
resolution: {integrity: sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==}
|
resolution: {integrity: sha512-Vp3CVhmYpgf4iXNKAucoQUDcCrBQX3XLBtwgFqP9BUXuucgvAV9zWp1kYU7LL9j4++s9O+12cb3wMtN4SJy6UQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@ -1412,12 +1374,6 @@ packages:
|
|||||||
bser: 2.1.1
|
bser: 2.1.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/filelist/1.0.4:
|
|
||||||
resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==}
|
|
||||||
dependencies:
|
|
||||||
minimatch: 5.1.6
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/fill-range/7.0.1:
|
/fill-range/7.0.1:
|
||||||
resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==}
|
resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@ -1501,6 +1457,7 @@ packages:
|
|||||||
/has-flag/4.0.0:
|
/has-flag/4.0.0:
|
||||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/has/1.0.3:
|
/has/1.0.3:
|
||||||
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
|
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
|
||||||
@ -1518,10 +1475,6 @@ packages:
|
|||||||
engines: {node: '>=10.17.0'}
|
engines: {node: '>=10.17.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/humanize-duration/3.28.0:
|
|
||||||
resolution: {integrity: sha512-jMAxraOOmHuPbffLVDKkEKi/NeG8dMqP8lGRd6Tbf7JgAeG33jjgPWDbXXU7ypCI0o+oNKJFgbSB9FKVdWNI2A==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/import-local/3.1.0:
|
/import-local/3.1.0:
|
||||||
resolution: {integrity: sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==}
|
resolution: {integrity: sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@ -1627,17 +1580,6 @@ packages:
|
|||||||
istanbul-lib-report: 3.0.0
|
istanbul-lib-report: 3.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/jake/10.8.5:
|
|
||||||
resolution: {integrity: sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
async: 3.2.4
|
|
||||||
chalk: 4.1.2
|
|
||||||
filelist: 1.0.4
|
|
||||||
minimatch: 3.1.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/jest-changed-files/29.4.0:
|
/jest-changed-files/29.4.0:
|
||||||
resolution: {integrity: sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==}
|
resolution: {integrity: sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==}
|
||||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||||
@ -2193,13 +2135,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion: 1.1.11
|
brace-expansion: 1.1.11
|
||||||
|
dev: true
|
||||||
/minimatch/5.1.6:
|
|
||||||
resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
brace-expansion: 2.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ms/2.1.2:
|
/ms/2.1.2:
|
||||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||||
@ -2235,21 +2171,6 @@ packages:
|
|||||||
path-key: 3.1.1
|
path-key: 3.1.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/nunjucks/3.2.3:
|
|
||||||
resolution: {integrity: sha512-psb6xjLj47+fE76JdZwskvwG4MYsQKXUtMsPh6U0YMvmyjRtKRFcxnlXGWglNybtNTNVmGdp94K62/+NjF5FDQ==}
|
|
||||||
engines: {node: '>= 6.9.0'}
|
|
||||||
hasBin: true
|
|
||||||
peerDependencies:
|
|
||||||
chokidar: ^3.3.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
chokidar:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
a-sync-waterfall: 1.0.1
|
|
||||||
asap: 2.0.6
|
|
||||||
commander: 5.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/once/1.4.0:
|
/once/1.4.0:
|
||||||
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -2289,10 +2210,6 @@ packages:
|
|||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/parse-duration/1.0.2:
|
|
||||||
resolution: {integrity: sha512-Dg27N6mfok+ow1a2rj/nRjtCfaKrHUZV2SJpEn/s8GaVUSlf4GGRCRP1c13Hj+wfPKVMrFDqLMLITkYKgKxyyg==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/parse-json/5.2.0:
|
/parse-json/5.2.0:
|
||||||
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
|
resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
@ -2539,6 +2456,7 @@ packages:
|
|||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dependencies:
|
dependencies:
|
||||||
has-flag: 4.0.0
|
has-flag: 4.0.0
|
||||||
|
dev: true
|
||||||
|
|
||||||
/supports-color/8.1.1:
|
/supports-color/8.1.1:
|
||||||
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#schema test
|
|
||||||
|
|
||||||
input
|
|
||||||
key value
|
|
||||||
|
|
||||||
output
|
|
||||||
level: 0 | head: key | tail: value | line: key value
|
|
@ -3,34 +3,41 @@ import fs from 'node:fs/promises'
|
|||||||
import { useDocument } from '@terrace/core'
|
import { useDocument } from '@terrace/core'
|
||||||
import { createReadlineReader } from '@terrace/core/readers/node-readline'
|
import { createReadlineReader } from '@terrace/core/readers/node-readline'
|
||||||
|
|
||||||
async function loadTest(path) {
|
async function loadTests(path) {
|
||||||
const { next, level, head, tail, line, match } = useDocument(createReadlineReader(path))
|
const { next, level, head, tail, line, match } = useDocument(createReadlineReader(path))
|
||||||
|
|
||||||
const test = { input: [], output: [] }
|
const tests = {}
|
||||||
|
|
||||||
while (await next()) {
|
while (await next()) {
|
||||||
if (match('input')) {
|
if (!head() || match('#schema')) continue
|
||||||
const rootLevel = level()
|
const rootLevel = level()
|
||||||
|
|
||||||
|
const test = tests[tail().trim()] = { input: [], output: [] }
|
||||||
|
|
||||||
while (await next(rootLevel)) {
|
while (await next(rootLevel)) {
|
||||||
test.input.push(line(rootLevel))
|
const testLevel = level()
|
||||||
|
if (match('input')) {
|
||||||
|
while (await next(testLevel)) {
|
||||||
|
test.input.push(line(testLevel))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match('output')) {
|
if (match('output')) {
|
||||||
const rootLevel = level()
|
while (await next(testLevel)) {
|
||||||
while (await next(rootLevel)) {
|
test.output.push(line(testLevel))
|
||||||
test.input.push(line(rootLevel))
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { input: test.input.join('\n'), output: test.output.join('\n') }
|
|
||||||
|
return tests
|
||||||
}
|
}
|
||||||
|
|
||||||
it('Runs a basic test', async () => {
|
it('Runs a basic test', async () => {
|
||||||
const { input, output } = await loadTest('./basic.test.tce', 'utf-8')
|
const tests = await loadTests('./tests.tce', 'utf-8')
|
||||||
|
|
||||||
console.log(input)
|
console.log(tests)
|
||||||
|
|
||||||
expect(1).to.equal(1)
|
expect(1).to.equal(1)
|
||||||
})
|
})
|
||||||
|
8
test/tests.tce
Normal file
8
test/tests.tce
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#schema test
|
||||||
|
|
||||||
|
test Basic
|
||||||
|
input
|
||||||
|
key value
|
||||||
|
|
||||||
|
output
|
||||||
|
level: 0 | head: key | tail: value | line: key value
|
Loading…
x
Reference in New Issue
Block a user