Let's look at the equality $\|f\|_{L^{p}({\bf{R}}^{n})}=\sup\left\{\displaystyle\int_{{\bf{R}}^{n}}\left|f(x)g(x)\right|dx: \|g\|_{L^{q}({\bf{R}}^{n})}\leq 1, g\in C_{0}^{\infty}({\bf{R}}^{n})\right\}$ for $1\leq p\leq\infty$ and $q$ is the conjugate for $p$, that is, $\dfrac{1}{p}+\dfrac{1}{q}=1$. Of course, this equality is true whenever $f\in L^{p}({\bf{R}}^{n})$. And I wonder if this is true for $f\notin L^{p}({\bf{R}}^{n})$ especially for the case that $f$ is NOT real-valued function almost everywhere, that is, what if $f$ attains the value $\infty$ on a certain subset of ${\bf{R}}^{n}$ which is not of measure zero?
One of a theorems in the book of N. Dinculeanu, Integration on Locally Compact Spaces suggests that the above equality holds. What if we change $C_{0}^{\infty}({\bf{R}}^{n})$ to another dense subset of $L^{p}({\bf{R}}^{n})$? Here, we are interested in dealing with the case $f\notin L^{p}({\bf{R}}^{n})$ only.
Of course, throughout this discussion, we assume that $f$ is an extended real-valued measurable function on ${\bf{R}}^{n}$, and we use the conventional operation that $0\cdot\infty=\infty\cdot 0=0\cdot-\infty=-\infty\cdot 0=0$.
And I wonder what if we are dealing with $\|f\|_{L^{p}({\bf{R}}^{n})}=\sup\left\{\left|\displaystyle\int_{{\bf{R}}^{n}}f(x)g(x)dx\right|: \|g\|_{L^{q}({\bf{R}}^{n})}\leq 1, g\in C_{0}^{\infty}({\bf{R}}^{n})\right\}$ for $f\notin L^{p}({\bf{R}}^{n})$? To be precise, since $f\notin L^{p}({\bf{R}}^{n})$, it does not always make sense to write $\displaystyle\int_{{\bf{R}}^{n}}f(x)g(x)dx$ for $g\in C_{0}^{\infty}({\bf{R}}^{n})$, so the indicated supremum runs through for all $\displaystyle\int_{{\bf{R}}^{n}}f(x)g(x)dx$ whenever it exists.
Here I found a partial answer to my question. First of all, I would like to quote the following theorem from the book of Gerd Grubb, Distributions and Operators:
(Page 22) Theorem 2.13. Let $M$ be a subset of ${\bf{R}}^{n}$, let $\epsilon>0$, and set $M_{k\epsilon}=\overline{M}+\underline{B}(0,k\epsilon)$ for $k>0$. There exists a function $\eta\in C^{\infty}({\bf{R}}^{n})$ which is $1$ on $M_{\epsilon}$ and is supported in $M_{3\epsilon}$, and which satisfies $0\leq\eta(x)\leq 1$ for all $x\in{\bf{R}}^{n}$.
So, if we are dealing with non-almost everywhere finite function $f$, let $F=\{x\in{\bf{R}}^{n}: |f(x)|=\infty\}$ and assume that $|F|>0$, so some $n_{0}\in{\bf{N}}^{n}$ is such that $E=F\cap[-n_{0},n_{0}]^{n}$, $|E|>0$, so the $g$ is chosen such that having compact support in $E_{3}$ and which is $1$ on $E_{1}$, hence $\displaystyle\int_{{\bf{R}}^{n}}|f(x)g(x)|dx\geq\displaystyle\int_{F}|f(x)|\cdot1dx=\infty$.
With the same virtue, if $f$ is almost everywhere finite, for each $N$, let $E_{N}=\{x\in{\bf{R}}^{n}: |f(x)|\leq N\}$ and $g_{N}\in C_{0}^{\infty}({\bf{R}}^{n})$ such that $g_{N}=1$ on $E_{N}$, then $\displaystyle\int_{{\bf{R}}^{n}}|f(x)g(x)|dx\geq\displaystyle\int_{E_{N}}|f(x)|dx$, taking $N\rightarrow\infty$, the result follows.