fixed registration of tests and functions as anonymous functions (closes #946)