Hacker News new | past | comments | ask | show | jobs | submit login

> Rust generates documentation from comments in Markdown syntax. Code in the docs gets run as tests. You can illustrate how a function is used and test it at the same time:

  /// Multiples the specified number by two
  ///
  /// ```
  /// assert_eq!(multiply_by_two(5), 10);
  /// ```
  fn multiply_by_two(x: i32) -> i32 {
      x * 2
  }
Okay that's pretty cool.




Perl has that as well: http://p3rl.org/Test::Inline


Godoc does this too




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: