Common wisdom seems to be that it's not a good idea once you get to the marathon distance, although it is for things like half marathons.
I think it's partly because running that far puts too much strain on your body to do it just before doing it "for real".
Paula Radcliffe was interviewed, and I can't remember the precise distance of her longest run, but it wasn't over 22 miles, and it may well have "only" been 20.