Search code examples
rubyrdocyardrustdoc

Documentation as tests in Ruby?


There is a great tool rustdoc (currently used by cargo) to test examples of documentation comments in Rust. Does rdoc or yard give us something similar in Ruby?


Solution

  • Well, there few examples of doctest tool in Ruby, and the most fresh one (for now) is yard-doctest:

    Meet YARD::Doctest - simple and magical gem, which automatically parses your @example tags and turn them into tests!

    Probably no so powerful as rustdoc, but it does what it needs to.