File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88### Fixed
99 * Fix a bug where the compiler would always generate inline function definitions even if the ` inline-functions ` compiler option is disabled (#1023 )
1010 * Fix a bug where ` defrecord ` /` deftype ` constructors could not be used in the type's methods. (#1025 )
11+ * Fix a bug where ` keys ` and ` vals ` would fail for records (#1030 )
1112
1213## [ v0.2.1]
1314### Changed
Original file line number Diff line number Diff line change 68696869 (contains? ~'_recmap ~key-gs)
68706870 (get ~'_recmap ~key-gs default#))))
68716871 (~'__getitem__ [~this-gs ~key-gs]
6872- (. ~this-gs ~'entry ~key-gs))
6872+ (.val-at ~this-gs ~key-gs))
68736873 (~'__iter__ [~this-gs]
6874- (seq ~this-gs))
6874+ (python/iter (map first ( seq ~this-gs)) ))
68756875 (~'__len__ [~this-gs]
68766876 (+ ~(count field-kw-set)
68776877 (count ~'_recmap)))
Original file line number Diff line number Diff line change 7373 ((juxt :w :x :y :z :new-key) p2)))
7474 (is (= [1 nil 3] ((juxt :x :y :z) p3))))
7575
76+ (testing "__getitem__ field access"
77+ (is (= 1 (.__getitem__ p :x)))
78+ (is (= 2 (.__getitem__ p :y)))
79+ (is (= 3 (.__getitem__ p :z)))
80+ (is (nil? (.__getitem__ p :l)))
81+ (is (= 0 (.__getitem__ p1 :w))))
82+
7683 (testing "assoc"
7784 (is (= 4 (:x (assoc p :x 4))))
7885 (is (= 5 (:y (assoc p :y 5))))
150157 (is (= #{[:x 1] [:z 3]}
151158 (set (seq p3)))))
152159
160+ (testing "iterator"
161+ (is (= #{:x :y :z} (set (seq (python/iter p)))))
162+ (is (= #{:w :x :y :z} (set (seq (python/iter p1)))))
163+ (is (= #{:w :x :y :z :new-key} (set (seq (python/iter p2))))))
164+
165+ (testing "keys"
166+ (is (= #{:x :y :z} (set (keys p))))
167+ (is (= #{:w :x :y :z} (set (keys p1))))
168+ (is (= #{:w :x :y :z :new-key} (set (keys p2)))))
169+
170+ (testing "vals"
171+ (is (= #{1 2 3} (set (vals p))))
172+ (is (= #{0 1 2 3} (set (vals p1))))
173+ (is (= #{0 1 2 3 "some-value"} (set (vals p2)))))
174+
153175 (testing "equals"
154176 (is (= (->Point 1 2 3) p))
155177 (is (= p1
You can’t perform that action at this time.
0 commit comments