jsdoctest icon indicating copy to clipboard operation
jsdoctest copied to clipboard

Feature Request: Multiline support

Open Eoksni opened this issue 6 years ago • 2 comments

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 :(

Eoksni avatar Mar 03 '18 22:03 Eoksni

@yamadapc Would a PR be welcome?

aaronjameslang avatar Jun 11 '18 09:06 aaronjameslang

Sure a PR would be welcome

yamadapc avatar Jun 13 '18 23:06 yamadapc