https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112018-07-20T14:39:00ZRuby Issue Tracking SystemRuby master - Feature #14925: Kernel#assert(expression)https://bugs.ruby-lang.org/issues/14925?journal_id=730402018-07-20T14:39:00Zshevegen (Robert A. Heiler)shevegen@gmail.com
<ul></ul><p>I can't say whether it is necessary or not; I test my ruby code<br>
quite differently (and really sparingly) compared to many other<br>
ruby hackers so I am not a good candidate to ask for any test<br>
or assertion system/framework.</p>
<p>Some testing frameworks make use of ruby in interesting ways,<br>
in my opinion.</p>
<p>Take RSpec:</p>
<pre><code>expect(Dir.exist?('doc')).to be true
</code></pre>
<p>The:</p>
<pre><code>.to be true
</code></pre>
<p>part surprised me the first time I saw it. :)</p>
<p>Python has doctest, I think, which is fairly minimal:</p>
<pre><code>doctest.testmod()
</code></pre>
<p>Don't know how useful it is, though. If I recall correctly<br>
then you wrote code in the function description. I personally<br>
found it a bit weird, since I'd expect more normal text in<br>
a description to a function/method.</p>
<p>To your suggestion - it may be that the ruby core team<br>
expects some more context in how your proposal may be<br>
used or how it may be useful; ideally compared to what<br>
is already used, such as for the ruby specification itself<br>
(the various test code of ruby; you can see these parts often<br>
when you look at ruby git at <a href="https://git.ruby-lang.org/ruby.git/" class="external">https://git.ruby-lang.org/ruby.git/</a> -<br>
the ruby dev team often writes test code in the .rb files).</p>
<p>I don't think there is any particularly high reason against<br>
your proposal as such (not sure if it should reside on Kernel<br>
or elsewhere, but I think this is a separate detail; the more<br>
important question is how the suggestion in itself may be<br>
sufficiently useful) - but the ruby dev team likes to have<br>
some specific details or some specific use case. Higher priority<br>
is usually given to when suggestions may solve existing problems,<br>
so in my opinion it often helps a lot to detail these problems<br>
or possible problems/pain points. (It also follows from the<br>
ruby philosophy, see how various suggestions have been accepted<br>
in the past when they referred to existing problems or constraints.)</p>