Make testDuplicateFunctions more robust

It should, but sometimes does not. I'll file a bug for this.