Comments (3)
👋 hi @j0ni
from bond.
This only happens with with-stub!
and not with with-stub
, right?
In this case, my personal preference would be to change the behaviour of with-stub!
from
Like with-stub, but throws an exception upon arity mismatch.
to
Like with-stub, but throws an exception upon arity mismatch where it's possible to detect such a mismatch. Some generated functions don't include
:arglists
in their metadata. For those functions, this macro will behave exactly likewith-stub
.
or something similar.
I wouldn't necessarily object to a warning, but this library does not currently depend on any logging interface or implementation and it would be nice to keep the dependencies as light as they currently are.
If others feel queasy about silently passing then we could insert something like:
(when-not (:arglists (meta v))
(throw (new #?(:clj IllegalArgumentException :cljs js/Error)
"with-stub! may only be used on functions which include :arglists in their metadata. Use with-stub instead.")))
in the appropriate position.
from bond.
Hey @conormcd, either of those solutions sounds ok to me, tho I would prefer the second.
I'm a fan of crashing over programming errors as early as possible, and this seems more like a programming error than a runtime snafu.
from bond.
Related Issues (10)
- Add back cloverage HOT 1
- License HOT 3
- Currently not working with cljs and advanced compilation HOT 1
- Thread-safe version of `with-spy` and `with-stub` HOT 2
- Preserve spec instrumentation when stubbing
- Trouble compiling when requiring bond in cljs test ns HOT 1
- Typo in README HOT 1
- `with-spy` doesn't seem to work on tests with `:inline` definitions in metadata HOT 2
- Asking for permission VS asking for forgiveness HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bond.