blob: 4c2b55485f1237bcc840cbe88af2f7dee5c7428f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
(;module:
lux
(lux [io]
(control monad)
(data text/format)
["&" host]
["R" random]
pipe)
lux/test)
(test: "JavaScript operations"
($_ seq
(assert "Null equals itself."
(is (&;null) (&;null)))
(assert "Undefined equals itself."
(is (&;undef) (&;undef)))
(assert "Can reference JavaScript objects."
(is (&;ref "Math") (&;ref "Math")))
(assert "Can create objects and access their fields."
(|> (&;object "foo" "BAR")
(&;get "foo" Text)
(is "BAR")))
(assert "Can call JavaScript functions"
(and (is 124.0
(&;call! (&;ref "Math.ceil" &;Function) [123.45] Real))
(is 124.0
(&;call! (&;ref "Math") "ceil" [123.45] Real))))
))
|