Added ref error/alloc to unit tests