Skip to content

Add golden tests that illustrate parsing results#3

Draft
andrewthad wants to merge 1 commit intomarseillebd:masterfrom
andrewthad:add-golden-tests
Draft

Add golden tests that illustrate parsing results#3
andrewthad wants to merge 1 commit intomarseillebd:masterfrom
andrewthad:add-golden-tests

Conversation

@andrewthad
Copy link
Copy Markdown
Contributor

@andrewthad andrewthad commented Sep 28, 2021

This adds a simple integration test that serves two purposes:

  1. Illustrate the ASTs resulting from parsing simple expressions. A combination of pretty-show and dropping all location annotations results in output that is at least somewhat readable. It would be better to manually write a pretty printer for the expression type, but that's more difficult to do.
  2. Confirm that the parser works as expected.

Concerning goal (2), I have a concern. I'm trying to use a string template in the input file, but the parser does not seem to understand what I've done:

         [ Chain
             ()
             (Symbol () "print" :||
                (Paren () (Just (String () "The dog is `years` years old!" [])) :|
                   []))
         ]) :|

I expected that years would be broken apart from the other stuff, but I might just be using string templates incorrectly.

@Zankoku-Okuno
Copy link
Copy Markdown
Collaborator

Only double-quoted strings allow templating. The single-quote strings are there specifically so that the only escaping that needs to be done is for single-quotes.

@andrewthad
Copy link
Copy Markdown
Contributor Author

Thanks, I had missed that. I've done a force push correcting the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants