nubank / matcher-combinators

Library for creating matcher combinator to compare nested data structures
Other
467 stars 23 forks source link

Change stubs to throw exceptions if used incorrectly #207

Open NoahTheDuke opened 1 year ago

NoahTheDuke commented 1 year ago

Closes #206

Implements the bad-usage macro as described in #206.

I've opened this as a draft because for some reason, I can't get the clojurescript half of this to work. Running the tests with bb test:node shows these errors, making me doubt that the tests are running correctly:

[:cli-test] Build completed. (76 files, 3 compiled, 6 warnings, 4.25s)

------ WARNING #1 - :undeclared-var --------------------------------------------
 File: /home/noah/personal/matcher-combinators/test/cljs/matcher_combinators/cljs_example_test.cljs:60:16
--------------------------------------------------------------------------------
  57 | 
  58 | (deftest bad-usage-test
  59 |   (is (thrown? js/Error
  60 |                (match? :expected :actual)))
----------------------^---------------------------------------------------------
 Use of undeclared Var matcher-combinators.cljs-example-test/java
--------------------------------------------------------------------------------
...

I don't see see how what I wrote is any different than what's in clojure-expectations, so I'm pretty confused.

NoahTheDuke commented 1 year ago

I've poked at this some more and I have no idea why there's an "undeclared-var" warning happening.