Comments (3)
Sorry for the late response, I somehow missed this message in my inbox.
I think we could be smarter about comparing two values in a similar to #===
way so that it supports comparing instances to classes, strings to regular expressions, etc.
For example, we could write any of these and they should pass.
true #=> true
true #=> TrueClass
"string" #=> "string"
"string" #=> /str/
[1, 2, 3] #=> Array
That would be implemented in a similar way as Ruby's case keyword or pattern matching where all these examples also are equal. Do you think that would cover your cases? Meanwhile, you can still write docs in a similar way:
obj === Array #=> true
In general, however, I don't think we should aim to cover all the possible assertions/matchers. The doctests should be lightweight so that anyone could read the example and comprehend them without knowing that those are also tests.
from yard-doctest.
I've just pushed ca7bf2e - you can see an example how to use it to assert instance of the object.
I just hope that switching to case equality won't break anything to existing users. @noraj Do you mind giving a new version a try if you use yard-doctest?
from yard-doctest.
I should give it a try for my next project.
from yard-doctest.
Related Issues (8)
- bug with using variable HOT 6
- `rake` is required although it's listed as dev dependency HOT 1
- Features fail on recent YARDs because they no longer auto-load plugins by default
- Feature idea: file-level filtering option HOT 5
- Deprecated warning from Minitest (5.11.3), wants `assert_nil`
- Thank you! HOT 1
- Support examples in README.md ? 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 yard-doctest.