yamadapc / jsdoctest

Run jsdoc examples as doctests.
https://yamadapc.github.io/jsdoctest
MIT License
92 stars 9 forks source link

Feature Request: Multiline support #35

Open Eoksni opened 6 years ago

Eoksni commented 6 years ago

I know doctests are supposed to be simple, but when one needs to match against objects, it is getting not pretty.

/**
 * @example
 * transition(newgame(), 'playerTwo')
 * // => { state: 'normal', playerOne: 'love', playerTwo: 15 }
 */

For the first part of assert I can do

/**
 * @example
 * (function() {
 *
 *  const game = newgame();
 *  return transition(game, 'playerTwo');
 *
 * })()
 * // => { state: 'normal', playerOne: 'love', playerTwo: 15 }
 */

so that is kinda multiline, although its not very pretty.

But the result object needs to be written in one line :(

aaronjameslang commented 6 years ago

@yamadapc Would a PR be welcome?

yamadapc commented 6 years ago

Sure a PR would be welcome