Skip to content

Commit 70cac33

Browse files
committed
test Clojure interpreter
1 parent 141679f commit 70cac33

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

test/lang-clojure-eval.test.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
import { assert, expect, test } from 'vitest'
2+
import {EditorState} from "@codemirror/state"
3+
import { evalString, sciInit } from "../src/sci"
24

3-
// Edit an assertion and save to see HMR in action
4-
5-
test('Math.sqrt()', () => {
6-
expect(Math.sqrt(4)).toBe(2)
7-
expect(Math.sqrt(144)).toBe(12)
8-
expect(Math.sqrt(2)).toBe(Math.SQRT2)
5+
test('evalString()', () => {
6+
let ctx = sciInit()
7+
expect(evalString(ctx, "(+ 1 2 3)")).toBe("6")
98
})
10-
11-
test('JSON', () => {
12-
const input = {
13-
foo: 'hello',
14-
bar: 'world',
15-
}
16-
17-
const output = JSON.stringify(input)
18-
19-
expect(output).eq('{"foo":"hello","bar":"world"}')
20-
assert.deepEqual(JSON.parse(output), input, 'matches original')
21-
})

0 commit comments

Comments
 (0)