test(controller): add unit tests for named function controllers syntax
fix(controller): make function name regex get only main function

The regex used to extract a function's name from it's string representation
should avoid matching inner function names. This commit means to fix this
wrong behavior.