In a textbook it says that you can show that $ \displaystyle\int_{-\infty}^{\infty} \frac{\cos(x^{2})+\sin(x^{2})-1}{x^{2}} \ dx = 0$ by considering $ \displaystyle f(z) = \frac{e^{iz^{2}}-1}{z^{2}}$ and integrating around a contour that consists of the real axis and the upper half of the circle $|z|=R$.
But that seems absurd since $e^{iz^{2}}$ grows exponentially along $|z|=R$ in the second quadrant as $R \to \infty$.
I think the problem is a bit more involved than it appears. You need to integrate two separate sections of the circle, using complex conjugates. Consider first the integral
$$\oint_C dz \frac{e^{i z^2}-1}{z^2}$$
where $C$ is a $45-$degree wedge in the first quadrant, of radius $R$. Then the contour integral is
$$\int_0^R dx \frac{e^{i x^2}-1}{x^2} + i R \int_0^{\pi/4} d\phi \, e^{i \phi} \frac{e^{i R^2 e^{i 2 \phi}}-1}{R^2 e^{i 2 \phi}}+ e^{i \pi/4} \int_R^0 dt \, \frac{e^{-t^2}-1}{e^{i \pi/2} t^2}$$
As $R \to \infty$, the second integral vanishes. (Why?) By Cauchy's theorem, the contour integral is zero. Thus,
$$\int_0^{\infty}dx \frac{e^{i x^2}-1}{x^2} = -e^{-i \pi/4} \int_0^{\infty} dx \frac{1-e^{-x^2}}{x^2}$$
Now consider
$$\oint_C dz \frac{e^{-i z^2}-1}{z^2}$$
where $C$ is a $45-$degree wedge in the second quadrant, of radius $R$. Then the contour integral is
$$e^{i \pi}\int_R^0 dx \frac{e^{-i x^2}-1}{x^2}+ e^{i 3 \pi/4} \int_0^R dt \, \frac{e^{-t^2}-1}{e^{i 3\pi/2} t^2} - i R \int_{\pi}^{3\pi/4} d\phi \, e^{i \phi} \frac{e^{-i R^2 e^{i 2 \phi}}-1}{R^2 e^{i 2 \phi}}$$
Take $R \to \infty$ again and find that
$$\int_0^{\infty}dx \frac{e^{-i x^2}-1}{x^2} = e^{-i 3 \pi/4} \int_0^{\infty} dx \frac{1-e^{-x^2}}{x^2}$$
The final thing to note is
$$\begin{align}\int_0^{\infty} dx \frac{\cos{(x^2)}+\sin{(x^2)}-1}{x^2} &= \frac1{\sqrt{2}} \int_0^{\infty} dx \frac{e^{-i \pi/4} (e^{i x^2}-1) + e^{i \pi/4} (e^{-i x^2}-1)}{x^2}\\ &= -\frac1{\sqrt{2}} e^{-i \pi/2} \int_0^{\infty} dx \frac{1-e^{-x^2}}{x^2}+\frac1{\sqrt{2}} e^{- i \pi/2} \int_0^{\infty} dx \frac{1-e^{-x^2}}{x^2}\\ &= 0\end{align}$$
Therefore, as the integrand is even,
$$\int_{-\infty}^{\infty} dx \frac{\cos{(x^2)}+\sin{(x^2)}-1}{x^2} = 0$$
as asserted.