writestring(f,'DOS'#13#10);\r
writestring(f,'UNIX'#10);\r
writestring(f,'MAC'#13);\r
+ writestring(f,'UNIX'#10);\r
writestring(f,'NONE');\r
closefile(f);\r
+ \r
+ writeln('reading test file in default mode (all line endings treated as line endings)');\r
t := treadtxt.createf('mixed.txt');\r
if t.readline = 'DOS' then writeln('DOS success') else writeln('DOS fail');\r
if t.readline = 'UNIX' then writeln('UNIX success') else writeln('UNIX fail');\r
if t.readline = 'MAC' then writeln('MAC success') else writeln('MAC fail');\r
+ if t.readline = 'UNIX' then writeln('UNIX success') else writeln('UNIX fail');\r
if t.readline = 'NONE' then writeln('NONE success') else writeln('NONE fail');\r
t.destroy;\r
- {$ifdef win32}\r
+ \r
+ writeln('reading test file with only CR treated as a line ending');\r
+ t := treadtxt.createf('mixed.txt');\r
+ t.allowedeol := eoltype_cr;\r
+ if t.readline = 'DOS' then writeln('DOS success') else writeln('DOS fail');\r
+ if t.readline = #10'UNIX'#10'MAC' then writeln('LF+UNIX+LF+MAC success') else writeln('LF+UNIX+LF+MAC fail');\r
+ if t.readline = 'UNIX'#10'NONE' then writeln('UNIX+LF+NONE success') else writeln('UNIX+LF+NONE fail');\r
+ t.destroy;\r
+\r
+ writeln('reading test file with only LF treated as a line ending');\r
+ t := treadtxt.createf('mixed.txt');\r
+ t.allowedeol := eoltype_lf;\r
+ if t.readline = 'DOS'#13 then writeln('DOS+CR success') else writeln('DOS+CR fail');\r
+ if t.readline = 'UNIX' then writeln('UNIX success') else writeln('UNIX fail');\r
+ if t.readline = 'MAC'#13'UNIX' then writeln('MAC+CR+UNIX success') else writeln('MAC+CR+UNIX fail');\r
+ if t.readline = 'NONE' then writeln('NONE success') else writeln('NONE fail');\r
+ t.destroy;\r
+\r
+ writeln('reading test file with only CRLF treated as a line ending');\r
+ t := treadtxt.createf('mixed.txt');\r
+ t.allowedeol := eoltype_crlf;\r
+ if t.readline = 'DOS' then writeln('DOS success') else writeln('DOS fail');\r
+ if t.readline = 'UNIX'#10'MAC'#13'UNIX'#10'NONE' then writeln('UNIX+LF+MAC+CR+UNIX+LF+NONE success') else writeln('UNIX+LF+MAC+CR+UNIX+LF+NONE fail');\r
+ t.destroy;\r
+\r
+ \r
+ {$ifdef mswindows}\r
//make things a little easier to test in the delphi GUI\r
readln;\r
{$endif}\r