Fix tests on darwin

String-level path comparisons don't work right on Darwin because of symlinks when the temp directories are created. We should compare the directory paths with os.SameFile instead.