Perron (1989, Econometrica 57, 1361–1401) introduced unit root tests valid when a break at a known date in the trend function of a time series is present. In particular, they allow a break under both the null and alternative hypotheses and are invariant to the magnitude of the shift in level and/or slope. The subsequent literature devised procedures valid in the case of an unknown break date. However, in doing so most research, in particular the commonly used test of Zivot and Andrews (1992, Journal of Business & Economic Statistics 10, 251–270), assumed that if a break occurs it does so only under the alternative hypothesis of stationarity. This is undesirable for several reasons. Kim and Perron (2009, Journal of Econometrics 148, 1–13) developed a methodology that allows a break at an unknown time under both the null and alternative hypotheses. When a break is present, the limit distribution of the test is the same as in the case of a known break date, allowing increased power while maintaining the correct size. We extend their work in several directions: (1) we allow for an arbitrary number of changes in both the level and slope of the trend function; (2) we adopt the quasi–generalized least squares detrending method advocated by Elliott, Rothenberg, and Stock (1996, Econometrica 64, 813–836) that permits tests that have local asymptotic power functions close to the local asymptotic Gaussian power envelope; (3) we consider a variety of tests, in particular the class of M-tests introduced in Stock (1999, Cointegration, Causality, and Forecasting: A Festschrift for Clive W.J. Granger) and analyzed in Ng and Perron (2001, Econometrica 69, 1519–1554).