bodil / bodil/purescript-test-unit
Maximum stack size exceeded at 387 unit tests
- Dominant language
- PureScript
- Stars
- 90
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
I currently have my tests set up in the following configuration and what it does is that it creates some `Tuple`s, which get inserted into a unit testing function which will give it a name and return a `TestF`. See the following example:
```purescript
propertyTest :: forall a iprop msg. Newtype iprop (Prop msg) => String -> iprop -> Free (TestF a) Unit
propertyTest name prop =
test name do
case unwrap prop of
Property propName _ -> Assert.equal name propName
_ -> failure $ "The test for the `" <> name <> "` property failed, because it got something other than a `Property`"
propertySuite :: forall a. Free (TestF a) Unit
propertySuite =
suite "Thorium.Html.Properties" do
traverse_ (uncurry propertyTest)
[ "accept" /\ accept "image/*"
, "action" /\ action "/action_page.php"
, "alt" /\ alt "An alt text"
, "autocomplete" /\ autocomplete true
, "autofocus" /\ autofocus true
, "charset" /\ charset "utf-8"
, "checked" /\ checked true
, "className" /\ (class' $ ClassName "unit-test")
, "className" /\ (classes [ ClassName "unit-test", ClassName "thorium" ])
, "cols" /\ cols 4
, "colspan" /\ colSpan 8
, "controls" /\ controls true
, "disabled" /\ disabled true
, "draggable" /\ draggable true
, "enabled" /\ enabled true
, "enctype" /\ (enctype $ MediaType "multipart/form-data")
, "for" /\ for "element-name"
, "height" /\ height 100
, "href" /\ href "pursuit.purescript.org"
, "id" /\ id "thorium-element"
, "loop" /\ loop true
, "max" /\ max 50.0
, "method" /\ (method GET)
, "min" /\ min 20.0
, "multiple" /\ multiple false
, "name" /\ name "element-name"
, "novalidate" /\ noValidate false
, "pattern" /\ pattern "/action_page.php"
, "placeholder" /\ placeholder "Username"
, "poster" /\ poster "url-to-image"
, "preload" /\ preload PreloadNone
, "readonly" /\ readOnly true
, "rel" /\ rel "stylesheet"
, "required" /\ required false
, "rows" /\ rows 5
, "rowspan" /\ rowSpan 2
, "selected" /\ selected true
, "spellcheck" /\ spellcheck false
, "src" /\ src "multi-media-source"
, "step" /\ (step $ Step 5.0)
, "tabindex" /\ tabIndex (-1)
, "target" /\ target "_blank"
, "title" /\ title_ "Thorium properties"
, "type" /\ type' "text"
, "value" /\ value "John Doe"
, "width" /\ width 200
]
```
```
/home/$user/Development/Git/thorium/output/Control.Monad.Aff/foreign.js:213
return function (success) {
^
RangeError: Maximum call stack size exceeded
```
This is of course a somewhat truncated version of the unit tests I have, but it gets the idea across. I asked for some help on PureScript Gitter for this issue and another user came up with the suggestion to make the `walkSuite` function a tail recursive function.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.