The usual test that a sample comes from a distribution of given form is performed by counting the number of observations falling into specified cells and applying the $\chi^2$ test to these frequencies. In estimating the parameters for this test, one may use the maximum likelihood (or equivalent) estimate based (1) on the cell frequencies, or (2) on the original observations. This paper shows that in (2), unlike the well known result for (1), the test statistic does not have a limiting $\chi^2$-distribution, but that it is stochastically larger than would be expected under the $\chi^2$ theory. The limiting distribution is obtained and some examples are computed. These indicate that the error is not serious in the case of fitting a Poisson distribution, but may be so for the fitting of a normal.