Let $\Omega \subset \mathbb{R}^n$ be open and $1\le p < \infty$. I'd like to know whether $C_c^\infty(\Omega)$, the set of the test functions on $\Omega$, is dense in $L^p(\Omega)$. I guess that it is true. I know that the set $C_c^\infty(\mathbb{R}^n)$ is dense in $L^p(\mathbb{R}^n)$. A function $f \in L^p(\Omega)$ may be represented as $g \in L^p(\mathbb{R}^n)$ such that $g = f$ on $\Omega$ and $g = 0$ for $\mathbb{R}^n - \Omega$. So $g$ can be approximated by a sequence in $C_c^\infty(\mathbb{R}^n)$ but I'm not sure whether we can always choose the sequence also to be in $C_c^\infty(\Omega)$.
Is $C_c^\infty(\Omega)$ actually dense in $L^p(\Omega)$? If so, how can I complete my approach? Any reference for a standard proof would be also helpful.
Let assume that $\Omega$ is bounded, otherwise we can reduce the problem to bounded $\Omega$ by using an countable partition of unity.
Let $f \in L^p(\Omega)$ be extended to $\mathbb{R}^n$ by zero outside of $\Omega$. Choose $g \in C_c(\mathbb{R}^n)$ with $\|f-g\|_{L^p(\mathbb{R}^n)} < \varepsilon$. Note that $$\|g\|_{L^p(\mathbb{R^n} \setminus \Omega)} = \|f-g\|_{L^p(\mathbb{R^n} \setminus \Omega)}< \varepsilon.$$ Now choose a bump function $h_\delta \in C_c^\infty( \Omega)$ with values in $[0,1]$ and $f = 1$ on $\Omega_\delta$, where $$\Omega_\delta = \{ z \in \Omega \colon |z-w| \ge \delta \quad \forall w \in \Omega\}.$$ We can choose also $\delta >0$ such that $\lambda(\Omega \setminus \Omega_\delta) < \epsilon/\|g\|_\infty$, because $\Omega$ is bounded. All in all $k:=hg \in C_c^\infty(\Omega)$ and \begin{align} \|k-f\|_{L^p(\Omega)} &\le \|f-g\|_{L^p(\mathbb{R}^n)} + \|g\|_{L^p(\mathbb{R}^n \setminus \Omega)} +\|(h-1)g\|_{L^p(\Omega)} \\ &\le 2 \varepsilon + \|g\|_\infty \lambda(\Omega \setminus \Omega_\delta) < 3 \varepsilon. \end{align}