treadln.nim 495 B

123456789101112131415161718192021222324
  1. discard """
  2. output: '''
  3. test the improved readline handling that does not care whether its
  4. Macintosh, Unix or Windows text format.
  5. '''
  6. """
  7. import std/syncio
  8. # test the improved readline handling that does not care whether its
  9. # Macintosh, Unix or Windows text format.
  10. var
  11. inp: File
  12. line: string
  13. if open(inp, "tests/stdlib/treadln.nim"):
  14. while not endOfFile(inp):
  15. line = readLine(inp)
  16. if line.len >= 2 and line[0] == '#' and line[1] == ' ':
  17. echo line[2..^1]
  18. close(inp)