Let $(S,g)$ be a closed and orientable Riemannian surface and let $\gamma : \mathbb{S}^1 \to S$ be a closed smooth curve. Suppose that there exists a (nonzero) closed differential $1$-form $\omega$ on $S$ such that $$\int_\gamma \omega \neq 0.$$
Can we conclude that the class of $\gamma$ in $H_1(S;\mathbb{Z})$ is nonzero?
If this is not the case, is there a criterion for "testing" the curve against cohomology classes to decide if it is homologous to zero?