Adding some logic for the case when the test string is empty in the file.
Adding some logic for the case when the test string is empty in the file.

The test string is empty when the file contains:
pattern\n
\n

The test string will be equal to "\n" when the file contains:
pattern\n
\n
\n

PavolVican/libyang,PavolVican/libyang,PavolVican/libyang,PavolVican/libyang,PavolVican/libyang