mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 04:44:12 +03:00
27 lines
778 B
Plaintext
27 lines
778 B
Plaintext
;; Sometimes code breaks when it is reloaded
|
|
;; It is hard to test proper reloading (using :r or '(reload)' though, since the
|
|
;; reload function keep tracks of what files has already evaluated and will ignore
|
|
;; those during startup). Instead, these tests will "simulate" reload by code duplication.
|
|
|
|
(load-and-use Test)
|
|
|
|
(deftype (Foo t) [x t])
|
|
|
|
(defmodule Foo
|
|
(defn = [a b]
|
|
(= (Foo.x a) (Foo.x b))))
|
|
|
|
;;(deftype (Foo t) [x t]) ;; <- this was the bug, simulate a reload of deftype
|
|
|
|
(defn test-deftype-bug []
|
|
(let [a (= &(Foo.init 123) &(Foo.init 666))
|
|
b (= &(Foo.init 123) &(Foo.init 123))]
|
|
(and (not a) b)))
|
|
|
|
(deftest test
|
|
(assert-true test
|
|
(test-deftype-bug)
|
|
"Ensure that bug with redefining type doesn't come back."
|
|
)
|
|
)
|