Method: TestML::Compiler::Lite#parse_assertion

Defined in:
lib/testml/compiler/lite.rb

#parse_assertionObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/testml/compiler/lite.rb', line 72

def parse_assertion
  return unless @tokens.grep /^#{COMP}$/
  @points = []
  left = parse_expression
  token = pop
  op =
    token == '==' ? 'EQ' :
    token == '~~' ? 'HAS' :
    fail_
  right = parse_expression
  pop if !done and peek == ';'
  fail_ unless done

  @function.statements.push TestML::Statement.new(
    left,
    TestML::Assertion.new(
      op,
      right,
    ),
    points.empty? ? nil : points
  )
  return true
end