Sha256: 4112769b36e7a19629fc6f57ff166a3e753f70de5e8401e5e462fe812181c5b2

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

require 'helper'

class TestParserEvaluator < Test::Unit::TestCase
  include Tickly::Emitter
  
  NUKE7_SCRIPT = File.open(File.dirname(__FILE__) + "/test-data/nuke7_tracker_2tracks.nk")
  
  class Tracker4
    attr_reader :knobs
    def initialize(knobs)
      @knobs = knobs
    end
  end
  
  class NodeCaptured < RuntimeError; end
  
  def test_processes_nodes
    pe = Tickly::NodeProcessor.new
    pe.add_node_handler_class(Tracker4)
    
    assert_raise(NodeCaptured) do
      pe.parse(NUKE7_SCRIPT) do | node |
        
        assert_kind_of Tracker4, node
        assert_equal "Tracker1", node.knobs["name"]
        
        raise NodeCaptured
      end
    end
  end
  
  def test_raises_without_a_block
    pe = Tickly::NodeProcessor.new
    assert_raise(LocalJumpError) { pe.parse(NUKE7_SCRIPT) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tickly-2.1.0 test/test_node_processor.rb
tickly-2.0.0 test/test_node_processor.rb