test: Factor out 'check_symlink' for stash tests