Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Plugin for unexpected providing support for generators and iterators

License

Notifications You must be signed in to change notification settings

gertsonderby/unexpected-generator

Repository files navigation

unexpected-generator

Depfu Build Status

http://www.shalominthewilderness.com/2013/07/horse-progress-days.html

Plugin for unexpected providing support for generators and iterators. It adds a type for iterators. Generators are tested by testing the iterator resulting from calling them.

Assertions

<iterator> [not] to be done

Asserts that the iterator is done, and that no further calls to next() will yield. Negating it to assert that it does yield will cause the iterator to advance one step, but any value is discarded.

<iterator> to yield item <any>

Asserts that the iterator yields, and that the value yielded matches the given item.

<iterator> to yield items <array>

Asserts that the iterator yields enough times and the correct items to match the list of items given in the array. If it is done before yielding the expected amount of items, the assertion will fail.

<iterator> to be done with <any>

Sends the given value to the iterator as a parameter of the next() call, and expects the iterator to be done at this point. If the iterator instead yields, the assertion fails.

<iterator> yielding with <any> <assertion?>

Sends the given value to the iterator as a parameter of the next() call, and shifts the resulting value to the following assertion, if any. If the iterator is done, this assertion fails.


MIT Licensed, © 2017 Gert Sønderby

About

Plugin for unexpected providing support for generators and iterators

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •