parinfer / parinfer.js

Let's simplify the way we write Lisp
https://shaunlebron.github.io/parinfer
MIT License
1.76k stars 40 forks source link

the great test overhaul #168

Closed shaunlebron closed 2 years ago

shaunlebron commented 7 years ago

It's becoming a problem that I cannot test certain options using annotation syntax.

@oakmac recommends splitting tests into their own files

==== Input
(text)

==== Options
(json)

==== Output
(text)

==== Result Structure
(json)

This may benefit from "snapshot testing", where the test runner will allow us to confirm the changed output or result structure so that it writes back to the file instead of failing the test suite.

The test runner can also print annotated forms of the data back into the file for readability:

===== Input (annotated)

===== Output (annotated)
shaunlebron commented 6 years ago

@oakmac is also envisioning an interactive page for creating/modifying test cases and seeing results live. and possibly pushing that page to the public website

oakmac commented 6 years ago

We could use kidif or eno for the storage of the test files.

shaunlebron commented 2 years ago

It was pretty painful adding manual test cases for certain options. I think allowing a preceding "js" block before the "in" block might be simplest for now.

shaunlebron commented 2 years ago

I added support for an options line at the start of the input block— enforcing an empty line afterward so it’s clearly separated from the actual input text.

options = { commentChars: '#' }

(def foo #)

I think we can do something similar for the output block if we want to verify some part of the returned structure. For example, I never added tests for the returned parens when the returnParens option is enabled. I’ll create a new issue for that.