2023-02-01 08:39:24 +00:00
|
|
|
# test *debug* flags
|
|
|
|
|
|
|
|
(import ./helper :prefix "" :exit true)
|
|
|
|
(start-suite 15)
|
|
|
|
|
2023-02-01 10:06:33 +00:00
|
|
|
(assert (deep= (in (disasm (defn a [] (def x 10) x)) :symbolslots)
|
2023-02-01 08:39:24 +00:00
|
|
|
@[])
|
2023-02-01 10:06:33 +00:00
|
|
|
"no symbolslots when *debug* is false")
|
2023-02-01 08:39:24 +00:00
|
|
|
|
|
|
|
(setdyn *debug* true)
|
2023-02-01 10:06:33 +00:00
|
|
|
(assert (deep= (in (disasm (defn a [] (def x 10) x)) :symbolslots)
|
|
|
|
@[[0 2147483647 0 "a"] [1 2147483647 1 "x"]])
|
|
|
|
"symbolslots when *debug* is true")
|
2023-02-01 08:39:24 +00:00
|
|
|
(setdyn *debug* false)
|
|
|
|
|
2023-02-01 10:06:33 +00:00
|
|
|
|
|
|
|
# need to fix assembling functions
|
|
|
|
(comment
|
|
|
|
(setdyn *debug* true)
|
|
|
|
(def f (asm (disasm (fn [x] (fn [y] (+ x y))))))
|
|
|
|
(assert (deep= (in (disasm f) :symbolslots)
|
|
|
|
@[[0 2147483647 0 "a"] [1 2147483647 1 "x"]])
|
|
|
|
"symbolslots survive disasm/asm")
|
|
|
|
(setdyn *debug* false)
|
|
|
|
)
|
|
|
|
|
2023-02-01 08:39:24 +00:00
|
|
|
(setdyn *debug* true)
|
2023-02-01 10:06:33 +00:00
|
|
|
(assert (deep= (in (disasm (defn a [arg]
|
2023-02-01 08:39:24 +00:00
|
|
|
(def x 10)
|
|
|
|
(do
|
|
|
|
(def y 20)
|
2023-02-01 10:06:33 +00:00
|
|
|
(def z 30)
|
|
|
|
(+ x y z)))) :symbolslots)
|
|
|
|
@[[-1 2147483647 0 "arg"]
|
|
|
|
[0 2147483647 1 "a"]
|
|
|
|
[1 2147483647 2 "x"]
|
|
|
|
[2 7 3 "y"]
|
|
|
|
[3 7 4 "z"]])
|
|
|
|
"arg & inner symbolslots")
|
2023-02-01 08:39:24 +00:00
|
|
|
(setdyn *debug* false)
|
|
|
|
|
|
|
|
(end-suite)
|