A fork of Crisp for HARP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
668 B

8 years ago
  1. class MalTestRunner
  2. def initialize(@test_file : String)
  3. end
  4. macro check_EOF
  5. return if l.is_a? Iterator::Stop
  6. end
  7. def each_test
  8. lines = File.open(@test_file).each_line
  9. until (l = lines.next).is_a? Iterator::Stop
  10. while l =~ /^\s*(;|$)/
  11. l = lines.next
  12. check_EOF
  13. end
  14. check_EOF
  15. input = l
  16. output = [] of String
  17. loop do
  18. l = lines.next
  19. check_EOF
  20. if l =~ /^; /
  21. output << l[2..-1]
  22. else
  23. break
  24. end
  25. end
  26. if l =~ /^;=>/
  27. yield input, output, l[3..-1]
  28. else
  29. yield input, output, nil
  30. end
  31. end
  32. end
  33. end