Move shared test code to a library so Tree.t doesn't have to be so huge