knrafto / language-bash

Parse and pretty-print Bash shell scripts
BSD 3-Clause "New" or "Revised" License
35 stars 9 forks source link

Test pretty printing #27

Closed mmhat closed 4 years ago

mmhat commented 4 years ago

While working on #24 it turned out that the current test suite performed poorly. Proposal:

  1. Drop a bash snippet somewhere in the tests/ directory
  2. Discover those snippets
  3. Parse them
  4. Pretty print them
  5. Compare the output to a golden file using tasty-golden
  6. Run bash on the original file and the pretty printed one and compare the output

This is of course only for those tests involving pretty printing; we can keep the existing unit tests as they are. Additionally we could fuzzy test the implementation with QuickCheck.

knrafto commented 4 years ago

Sounds great! Could we scope the issue down to "test pretty-printing" and open new issues for other possible improvements? Otherwise we'd never be able to close this issue - the test suite could always be improved :)

Possibly dumb question, why is TemplateHaskell required for step 2 instead of discovering the files at runtime?

mmhat commented 4 years ago

Your right, I changed the title and 2. of the issue.