haskell-src-match: Testing code generators piece by piece.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Matching of Haskell source fragments for code generator unit tests.


[Skip to Readme]

Properties

Versions 0.0.0.1, 0.0.0.1
Change log ChangeLog.md
Dependencies base (>=4.3 && <4.15), containers, haskell-src-exts, interpolatedstring-perl6, pretty-simple, split, template-haskell, transformers [details]
License BSD-3-Clause
Copyright 2018-2019, Migamake Pte Ltd
Author Dmitry Krylov, Michal J. Gajda
Maintainer haskell-src-match@migamake.com
Category testing
Home page https://github.com/migamake/haskell-src-match#readme
Bug tracker https://github.com/migamake/haskell-src-match/issues
Source repo head: git clone https://github.com/migamake/haskell-src-match
Uploaded by MichalGajda at 2020-08-23T17:37:59Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for haskell-src-match-0.0.0.1

[back to package description]

Goal

Leverage your knowledge of haskell-src-exts for parsing Haskell source files, and checking that they contain prescribed fragments. This is a general problem of functional testing of code generators: One would like to make it modular, but at the same time as close to produced source as possible. I propose that you parse a Haskell output from code generator with haskell-src-exts and then match on the produced file. Matching would be best done using TemplateHaskell. Or you may also use Haskell-src-exts here in quasiquotes. so this could be an independent library that we use to make xml-typelift and json-autotype better.

Milestones

  1. Parse input module with haskell-src-exts, and get a list of type declarations, and a list of instance declarations. (Easy)
  2. Use haskell-src-exts to get a data structure from quasiquote.
  3. Make a matching function out of a data structure returned by quasiquote.
  4. Add convenience interface to parse output file with haskell-src-exts and match patterns.
  5. Change all identifiers starting with an underbar (like _function) to be variables. Modify matching function accordingly
  6. Change all type identifiers starting with an U_ to be variables.
  7. Change all class identitifers starting with an U_ to be variables.
  8. Make a test suite for xml-typelift using this.

Possible improvements for the future

Not yet clear that we need this last feature for testing: