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

Filter out parse_transforms from compilation options #32

Merged
merged 1 commit into from
Jul 25, 2011

Conversation

djnym
Copy link
Contributor

@djnym djnym commented Jul 24, 2011

I apply a local parse_transform to almost all my code which adds a -vsn() to the code. When I attempt to use meck on one of these I get a compilation exception. After some investigation (involving adding [verbose, report_errors, report_warnings] to the compile options, something you may consider doing as a convenience).

I discovered it was because the parse transform was not in the code path. Attempts to add paths and things like that seemed annoying at best, and hard to make general. However, the parse_transforms have already been applied to the forms which meck is modifying, so compiling with them again doesn't make any sense. So I filter them out.

…y applied to the abstract code, they are unnecessary when mocking, so filter them out of the compilation options
eproxus added a commit that referenced this pull request Jul 25, 2011
Filter out parse_transforms from compilation options
@eproxus eproxus merged commit 2e82eae into eproxus:master Jul 25, 2011
@eproxus
Copy link
Owner

eproxus commented Jul 25, 2011

I originally left out those compilation options because I don't like when libraries like this are verbose and print out things to the console. It tends to mess up test output etc. However, a good idea might be to add an {compile, Options} option to meck?

@djnym
Copy link
Contributor Author

djnym commented Jul 25, 2011

Alternatively in the error clause of compile_and_load_forms you could do something like

Error ->
  % compile again with verbose reporting
  compile:forms (AbsCode, [verbose, report_errors, report_warnings | Opts])

So if an error occurs you get more information. However, if you did add the option, then you could do something like add a parse transform to the meck compilation (just make sure you add in the options post filtering out of parse_transforms ;)), which might be useful to someone someday.

@eproxus
Copy link
Owner

eproxus commented Jul 25, 2011

Did discover that there's also the options return_errors and return_warnings (or the short return for both). Those could be printed if returned (at least the errors, compiler warnings are not uncommon, especially for code you don't control).

The parse transform of mocked modules is a great idea! That would justify the {compile, Options} flag in itself.

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

Successfully merging this pull request may close these issues.

None yet

2 participants