Can I test line break types? e.g. line endings of type LF or LFCR?
No, or at least not from the TeX end (LuaTeX is different: can use Lua). Line-end normalisation happens very early, before any TeX code gets to see anything. As such, all you will ever get is characters of the value of \endlinechar
, so they are always all the same (and so life is easy for the macro programmer).
Not only can you not tell what is the line end terminator you can not tell if there was a linebreak character at all, nor can you tell if there were any space characters at the end of the line.
This is all in the system-specific part of TeX hidden from the macro layer.
On a mainframe with fixed length text fields there may be no line character and all lines are 80 (or 132 or whatever) characters wide, but the tex implementation on such machines will (or did when they existed) strip all trailing white space and make the input appear to be a stream of characters with a single \endlinechar
marking lines (records).
Similarly on tex implementations that do use a stream with end of line terminators, the web2c tex implementation normalises LF, CR or CRLF pairs to a single end of line, and all space characters before such a marker are removed.