Class: FormatsTests

Inherits:
Object
  • Object
show all
Defined in:
lib/formats_tests.rb

Class Method Summary collapse

Class Method Details

.format(lines) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/formats_tests.rb', line 2

def self.format(lines)
  lines = lines.split("\n")

  lines.each.with_index do |line, i|
    match = line.match(/val (.*?_test\d) = (.*?)$/)

    if match
      lines[i] = "val #{match[1]} = assert \"#{match[1]}\" (#{match[2]})"
    end
  end

  # TODO: make this a little nicer
  'fun assert desc condition = print(desc^" "^Bool.toString(condition)^"\n")' + "\n" + lines.join("\n")
end