require_relative "helper" require 'minitest/spec' include Vm class FakeBuilder attr_reader :result Asm::InstructionTools::REGISTERS.each do |reg , number| define_method(reg) { Asm::Register.new(reg , number) } end def initialize @result = '' end def class_builder 'example' end def int 'int' end def method_missing(name, *args, &block) @result += ([name] + args.flatten).join(', ').sub(',', '') @result += "\n" block.call(self) if name.to_s == 'public_static_method' end end describe 'Nodes' do before do @context = Hash.new @builder = FakeBuilder.new end it 'emits a number' do input = Vm::NumberExpression.new 42 expected = <