Skip to content

Conversation

@Pagolin
Copy link

@Pagolin Pagolin commented Jul 30, 2021

I needed a Quasiquoter, so I added a simple one (basically a wrapper for dataToExp.
I had the existing test running through, with obviously no error, but didn't manage to add tests yet.
However I thought it might be useful for someone.

Pagolin added 2 commits July 29, 2021 19:41
there is now a quasi quoter for
expressions (modules, statements, python expression)
in version 3
Todo:
parser is initializied at location 0,0, hence
multi-line quotes need to be left-aligned
-> todo: use internal parser initialization and
set start location
@bjpop
Copy link
Owner

bjpop commented Jul 31, 2021

This looks great. Can you please show some examples of its use? Maybe some examples can be put in the header documentation for Language.Python.Common.Quoter?

@Pagolin
Copy link
Author

Pagolin commented Aug 4, 2021

Like so?

@bjpop
Copy link
Owner

bjpop commented Aug 5, 2021

Looks great thanks! Would it be possible to add some test cases to the test suite as well?

@Pagolin
Copy link
Author

Pagolin commented Aug 5, 2021 via email

@bjpop
Copy link
Owner

bjpop commented Aug 19, 2021

Hi @Pagolin.

I would like to pull this code into the repository.

I do prefer to have some test cases to use when doing the pull. Your suggested approach sounds reasonable. I find that testing against hand written ASTs can be a bit laborious, and thus few tests get written this way.

Another approach is to do a kind of "round trip" testing, by quoting some code, then pretty printing it back to a rendered string, and then comparing that string to the expected code.

This is not perfect, because it relies on the pretty printer being stable, and it is not in the spirit of a unit test. However, it tends to be easier to do, and therefore more tests can get written, which has its own advantages.

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