Module: InterpreterTestingMethods

Defined in:
lib/blockly_interpreter/blockly_interpreter_test_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



84
85
86
# File 'lib/blockly_interpreter/blockly_interpreter_test_helper.rb', line 84

def self.included(mod)
  mod.let(:parser) { BlocklyInterpreter::Parser.new }
end

Instance Method Details

#assert_outputs(value, **variables, &block) ⇒ Object



88
89
90
91
92
# File 'lib/blockly_interpreter/blockly_interpreter_test_helper.rb', line 88

def assert_outputs(value, **variables, &block)
  xml = BlocklyInterpreter::DSL.build_xml(&block)
  program = parser.parse(xml)
  TestInterpreter.new(program, variables).content.must_equal value
end