"And when Delilah saw that he had told her all his heart" (Judges 16:18). How did she know? Rabbi Hanin said: the words of truth are recognizable. Abaye said: she knew about that righteous man that he would not bring forth the Name of Heaven in vain; since he said "I have been a Nazirite unto God" (Judges 16:17), she said: now it is certain he speaks the truth.
How Delilah Knew Samson Had Told Her the Truth
Yalkut Shimoni on Nach 70:8
ותרא דלילה כי הגיד לה את כל לבו. מנא ידעה, א"ר חנין נכרין דברי אמת, אביי אמר ידעה ביה באותו צדיק דלא מפיק שם שמים לבטלה כיון דאמר נזיר אלהים אנכי אמרה השתא ודאי קושטא קאמר: