Skip to content

Instantly share code, notes, and snippets.

@lpgauth
Created July 14, 2015 18:57
Show Gist options
  • Save lpgauth/5580f87aaac40b9c1d53 to your computer and use it in GitHub Desktop.
Save lpgauth/5580f87aaac40b9c1d53 to your computer and use it in GitHub Desktop.
-module(test).
-export([
macro/0
]).
-ifdef(TEST).
-define(IF_DEF_TEST, fun (A, _) -> A end).
-else.
-define(IF_DEF_TEST, fun (_, B) -> B end).
-endif.
macro() ->
?IF_DEF_TEST(0, 1).
@lpgauth
Copy link
Author

lpgauth commented Jul 14, 2015

1> c(test).
{ok,test}
2> test:macro().
1
3> c(test, [{d, 'TEST'}]).
{ok,test}
4> test:macro().
0

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