package invalid.lena.rsend

import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Test

class SyncLogTest {

    @Test
    fun controlCharactersCannotForgeLogLinesOrTerminalOutput() {
        val clean = SyncLog.cleanLine("name\nnext\t\u001b[31m\u007f\u2028\u202e")

        assertEquals("name\\nnext\\u0009\\u001b[31m\\u007f\\u2028\\u202e", clean)
        assertFalse(clean.any(Char::isISOControl))
    }
}
