seanmay/io-guard

Feature: Add a guard wrapper for writing simple custom tests

Closed this issue · 0 comments

Feature spawned by #4
Remembering x is T, and remembering not to refactor it away from the point of invocation is painful.
Equally painful is remembering to protect against null and undefined showing up and throwing errors in your test, when the rest of the library is supposed to fail gracefully.

A wrapper for solving those two problems, and allowing for writing of any arbitrary "truthy" test, while guaranteeing a x is T type assertion, and protecting from missing values (which would then still work as expected when wrapped by optional nullable and erratic).

Initial thoughts are createTest<a>(a -> any) and Test<a>(a -> any).