Fork me on GitHub
#kaocha
<
2020-04-21
>
rgm06:04:58

I’m trying to implement my first deftype for physical quantities like 1.0 m**2 (more or less a tuple) and I’m a bit confused about what kaocha’s using to convert it to strings for test reporting. In the initial deftype I’ve implemented toString of Object. It seems to be picking that up in clj but not in cljs:

FAIL in cljs:nzn.esc-targets-test/air-changes-above-6999-hdd-18 (cljs/test.js:424)
Expected:
  #object[opengb.dram.core.Quantity]
Actual:
  #object[opengb.dram.core.Quantity]
Diff:
  - #object[opengb.dram.core.Quantity]
  + #object[opengb.dram.core.Quantity]

FAIL in nzn.esc-targets-test/air-changes-above-6999-hdd-18 (esc_targets_test.cljc:24)
Expected:
  #<[email protected] <2.0 ACH>>
Actual:
  -#<[email protected] <2.0 ACH>> +#<[email protected] <3.0 ACH>>
8 tests, 24 assertions, 2 failures.

rgm06:04:27

I scanned through cljs core looking for other protocols (eg. I had to flip to IEquiv for equality since equals seems to also be clj only), but nothing hopped out at me.

rgm06:04:34

I wouldn’t think print-method or print-dup would have much to do with cljs, but I’m always willing to be surprised, I guess.