File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 73
73
(size* [_ data]
74
74
(reduce (fn [acc [field data]]
75
75
(let [type (field dict)]
76
- (if (satisfies? ISpecSize type)
77
- (+ acc (size type))
78
- (+ acc (size* type data )))))
76
+ (if (satisfies? ISpecDynamicSize type)
77
+ (+ acc (size* type data ))
78
+ (+ acc (size type)))))
79
79
0
80
80
(into [] data)))
81
81
Original file line number Diff line number Diff line change 466
466
(t/is (= readed 24 ))
467
467
(t/is (= data [1 2 3 4 5 ])))))
468
468
469
+ (t/deftest spec-associative-nested-dynamic
470
+ (let [spec (buf/spec :outer (buf/spec :inner (buf/vector* buf/int32)))
471
+ buffer (buf/into (buf/spec :outer (buf/spec :inner (buf/vector* buf/int32))) {:outer {:inner [1 ]}})
472
+ written (impl/get-capacity buffer)]
473
+ (t/is (= written 8 ))
474
+
475
+ (let [[readed data] (buf/read* buffer spec)]
476
+ (t/is (= readed 8 )
477
+ (t/is (= data {:outer {:inner [1 ]}}))))))
478
+
469
479
#?(:cljs
470
480
(do
471
481
(enable-console-print! )
You can’t perform that action at this time.
0 commit comments