I'm no testing expert (believe me) but isn't it easier to just call the function directly rather than compile a catalog?  It's a lot of overhead just to call a function and test the return like:

Puppet::Parser::Functions.function("deep_merg").with(foo).should == x