Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate programs matching a syntatic pattern... using libcst matchers #28

Open
Zac-HD opened this issue Apr 11, 2023 · 0 comments
Open

Comments

@Zac-HD
Copy link
Owner

Zac-HD commented Apr 11, 2023

Sometimes you want to test code on some particular syntatic structure - nested context managers perhaps, or binary operators with comments between the clauses (both real examples!).

I was recently explaining to a friend that I couldn't work out how to generate these automatically, because it was really hard to come up with an expressive yet ergonomic way to specify "just enough" structure... and then immediately realized that LibCST Matchers provide exactly that, and we're already working with their node objects anyway for the from_node() strategy.

Let's make a from_matcher() strategy!

I don't even have a design sketch here, but while I expect the implementation to be quite a lot of work, it'll probably be more tedious than especially difficult (relative to, you know, state-of-the-art random program generation without leaning on a fantastic CST library).

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

No branches or pull requests

1 participant