mirror of
https://github.com/janet-lang/janet
synced 2025-10-22 19:27:43 +00:00
Change metadata keyword back to :redef
This commit is contained in:
@@ -297,23 +297,28 @@
|
||||
|
||||
# Dynamic defs
|
||||
|
||||
(def staticdef 0)
|
||||
(defn staticdef-inc [] (+ 1 staticdef))
|
||||
(assert (= 1 (staticdef-inc)) "result before redefinition without :dynamic")
|
||||
(def staticdef 1)
|
||||
(assert (= 1 (staticdef-inc)) "result after redefinition without :dynamic")
|
||||
(def dynamicdef :dynamic 0)
|
||||
(defn dynamicdef-inc [] (+ 1 dynamicdef))
|
||||
(assert (= 1 (dynamicdef-inc)) "result before redefinition with :dynamic")
|
||||
(def dynamicdef :dynamic 1)
|
||||
(assert (= 2 (dynamicdef-inc)) "result after redefinition with :dynamic")
|
||||
(setdyn :dynamic-defs true)
|
||||
(def staticdef1 0)
|
||||
(defn staticdef1-inc [] (+ 1 staticdef1))
|
||||
(assert (= 1 (staticdef1-inc)) "before redefinition without :redef")
|
||||
(def staticdef1 1)
|
||||
(assert (= 1 (staticdef1-inc)) "after redefinition without :redef")
|
||||
(def dynamicdef1 :redef 0)
|
||||
(defn dynamicdef1-inc [] (+ 1 dynamicdef1))
|
||||
(assert (= 1 (dynamicdef1-inc)) "before redefinition with :redef")
|
||||
(def dynamicdef1 :redef 1)
|
||||
(assert (= 2 (dynamicdef1-inc)) "after redefinition with :redef")
|
||||
(setdyn :redefs true)
|
||||
(def staticdef2 {:redef false} 0)
|
||||
(defn staticdef2-inc [] (+ 1 staticdef2))
|
||||
(assert (= 1 (staticdef2-inc)) "before redefinition with :redef false")
|
||||
(def staticdef2 {:redef false} 1)
|
||||
(assert (= 1 (staticdef2-inc)) "after redefinition with :redef false")
|
||||
(def dynamicdef2 0)
|
||||
(defn dynamicdef2-inc [] (+ 1 dynamicdef2))
|
||||
(assert (= 1 (dynamicdef2-inc)) "result before redefinition with :dynamic-defs")
|
||||
(assert (= 1 (dynamicdef2-inc)) "before redefinition with dyn :redefs")
|
||||
(def dynamicdef2 1)
|
||||
(assert (= 2 (dynamicdef2-inc)) "result after redefinition with :dynamic-defs")
|
||||
(setdyn :dynamic-defs nil)
|
||||
(assert (= 2 (dynamicdef2-inc)) "after redefinition with dyn :redefs")
|
||||
(setdyn :redefs nil)
|
||||
|
||||
# Denormal tables and structs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user