Factor out common name binding test code