Here "test my heart" means to examine my thoughts and motives. Alternate translation: "If you examine my thoughts in the night" (See: [[rc://en/ta/man/jit/figs-idiom]])
Here the mouth is spoken of as if it were capable of acting on its own. It also represents the words that a person speaks. Alternate translation: "I will not tell lies or sin with my words" (See: [[rc://en/ta/man/jit/figs-personification]] and [[rc://en/ta/man/jit/figs-synecdoche]])