We investigate the gravitational fragmentation of expanding shells in the context of the linear thin-shell analysis. We make use of two very different numerical schemes; the flash adaptive mesh refinement code and a version of the Benz smoothed particle hydrodynamics code. We find that the agreement between the two codes is excellent. We use our numerical results to test the thin-shell approximation and we find that the external pressure applied to the shell has a strong effect on the fragmentation process. In cases where shells are not pressure-confined, the shells thicken as they expand and hydrodynamic flows perpendicular to the plane of the shell suppress fragmentation at short wavelengths. If the shells are pressure-confined internally and externally, so that their thickness remains approximately constant during their expansion, the agreement with the analytical solution is better.