28 lines
690 B
TypeScript
28 lines
690 B
TypeScript
import { expect, describe, test } from 'bun:test'
|
|
import { globalFunctions } from '#prelude'
|
|
|
|
describe('use', () => {
|
|
test(`imports all a file's functions`, async () => {
|
|
expect(`
|
|
use ./src/prelude/tests/math
|
|
dbl = math | at double
|
|
dbl 4
|
|
`).toEvaluateTo(8, globalFunctions)
|
|
|
|
expect(`
|
|
use ./src/prelude/tests/math
|
|
math | at pi
|
|
`).toEvaluateTo(3.14, globalFunctions)
|
|
|
|
expect(`
|
|
use ./src/prelude/tests/math
|
|
math | at 🥧
|
|
`).toEvaluateTo(3.14159265359, globalFunctions)
|
|
|
|
expect(`
|
|
use ./src/prelude/tests/math
|
|
call = do x y: x y end
|
|
call (math | at add1) 5
|
|
`).toEvaluateTo(6, globalFunctions)
|
|
})
|
|
}) |