Compare commits
9 Commits
de30d85304
...
4f092fca3f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f092fca3f | ||
| b50dafe79d | |||
| af7f389a04 | |||
| 67a98837ed | |||
| b42675e1d9 | |||
| 354df33894 | |||
| 66d21ce72b | |||
| d7bcc590fe | |||
| 787d2f2611 |
2
bun.lock
2
bun.lock
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
"hono": ["hono@4.9.8", "", {}, "sha512-JW8Bb4RFWD9iOKxg5PbUarBYGM99IcxFl2FPBo2gSJO11jjUDqlP1Bmfyqt8Z/dGhIQ63PMA9LdcLefXyIasyg=="],
|
||||
|
||||
"reefvm": ["reefvm@git+https://git.nose.space/defunkt/reefvm#e54207067734d2186cd788c3654b675b493c2585", { "peerDependencies": { "typescript": "^5" } }, "e54207067734d2186cd788c3654b675b493c2585"],
|
||||
"reefvm": ["reefvm@git+https://git.nose.space/defunkt/reefvm#97b6722a113417398a1c47d583bfe07a906f87a0", { "peerDependencies": { "typescript": "^5" } }, "97b6722a113417398a1c47d583bfe07a906f87a0"],
|
||||
|
||||
"style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="],
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@
|
|||
"update-reef": "cd packages/ReefVM && git pull origin main"
|
||||
},
|
||||
"dependencies": {
|
||||
"reefvm": "git+https://git.nose.space/defunkt/reefvm",
|
||||
"@codemirror/view": "^6.38.3",
|
||||
"@lezer/generator": "^1.8.0",
|
||||
"bun-plugin-tailwind": "^0.0.15",
|
||||
"codemirror": "^6.0.2",
|
||||
"hono": "^4.9.8",
|
||||
"reefvm": "git+https://git.nose.space/defunkt/reefvm",
|
||||
"tailwindcss": "^4.1.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { parser } from '#parser/shrimp'
|
|||
import { $ } from 'bun'
|
||||
import { assert, errorMessage } from '#utils/utils'
|
||||
import { Compiler } from '#compiler/compiler'
|
||||
import { run, VM } from 'reefvm'
|
||||
import { run, VM, type TypeScriptFunction } from 'reefvm'
|
||||
import { treeToString, VMResultToValue } from '#utils/tree'
|
||||
|
||||
const regenerateParser = async () => {
|
||||
|
|
@ -33,7 +33,7 @@ declare module 'bun:test' {
|
|||
toMatchTree(expected: string): T
|
||||
toMatchExpression(expected: string): T
|
||||
toFailParse(): T
|
||||
toEvaluateTo(expected: unknown, globals?: Record<string, any>): Promise<T>
|
||||
toEvaluateTo(expected: unknown, globalFunctions?: Record<string, TypeScriptFunction>): Promise<T>
|
||||
toFailEvaluation(): Promise<T>
|
||||
}
|
||||
}
|
||||
|
|
@ -96,13 +96,13 @@ expect.extend({
|
|||
async toEvaluateTo(
|
||||
received: unknown,
|
||||
expected: unknown,
|
||||
globals: Record<string, any> = {}
|
||||
globalFunctions: Record<string, TypeScriptFunction> = {}
|
||||
) {
|
||||
assert(typeof received === 'string', 'toEvaluateTo can only be used with string values')
|
||||
|
||||
try {
|
||||
const compiler = new Compiler(received)
|
||||
const result = await run(compiler.bytecode, globals)
|
||||
const result = await run(compiler.bytecode, globalFunctions)
|
||||
let value = VMResultToValue(result)
|
||||
|
||||
// Just treat regex as strings for comparison purposes
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user