hy/tests/native_tests/with_decorator.hy
2014-11-15 07:47:55 -05:00

23 lines
338 B
Hy

(defn foodec [func]
(lambda [] (+ 1 1)))
(with-decorator foodec
(defn tfunction []
(* 2 2)))
(defn bardec [cls]
(setv cls.my_attr 123)
cls)
(with-decorator bardec
(defclass cls []
[[my_attr 456]]))
(defn test-decorators []
"NATIVE: test decorators."
(assert (= (tfunction) 2))
(assert (= cls.my_attr 123)))