Skip to main content

Posts

Showing posts from 2009

Regular Expression Cheat Sheet YEAHH!!

...NOT! There seems to be no good regex escaping cheat-sheet, that is easy to find.
I was so tired of remebering when to escape what in grep, awk, sed and emacs, that I asked google for help. The result of my search was not very satisfying :(

So I started this blogpost as the location for gathering all diffrent escaping styles that I find during my daily work.

sed
\(\)\+*.\/ (backslash must be escaped, even if not used as seperator cahracter)\|

grep
Like sed.

it

it

syllables stroke hidden performances, relentlessly
while she is singing
with his song she - flowers and shines in a shower
half through and yet stuck
off by an occurence - hesitating

wandering through grayness colorfull her tears
hidden permitted to beast
breaks old and new and she will see
he is falling unforgottenly muted

blended by invisable light not so pure
not shining - hesitate!
clicked links to the past before her metamorphoses
cuting moments of pain and pity

grayness wandering colorfull through his tears
stainless trees fallen in the way
running in a direction and the other
where will we go from here?

Erlang mock - erlymock

NOTE THIS POST IS OUTDATED!
The project has evolved and can be found here: ErlyMock


Some features

Easy to use
Design based on easymock
Works together with otp: can be used even if the clut is called from another process, by invoking mock:verify_after_last_call(Mock,optional: timeout)
custom return functions
predefined return functions for returning values, receiving message, throwing exceptions, etc..
erlymock automatically purges all modules that were mocked, after verify()
Custom argument matchers:

%% Orderchecking types: in_order, out_of_order, stub;
%% Answering: {return, ...}|{error, ...}|{throw, ...}|{exit, ...}|{rec_msg, Pid}|{function, Fun(Args) -> RetVal}
expect(Mock, Type, Module, Function, Arguments, Answer = {AT, _}) when AT==return;AT==error;AT==throw;AT==exit;AT==rec_msg;AT==function ->
call(Mock, {expect, Type, Module, Function, length(Arguments), {Arguments, Answer}}).

%% this version of expect is suited for useing custom argument matchers
expect(Mock, Type, Module, Fun, …