Sha256: 357d3856857c78be91378879b9ea3a1b1fe83d23a184a2b8b982a46835704233

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

require 'helper'

class TestParserEvaluator < Test::Unit::TestCase
  
  HUGE_SCRIPT = File.open(File.dirname(__FILE__) + "/test-data/huge_nuke_tcl.tcl")
  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.3 test/test_node_processor.rb
tickly-2.1.2 test/test_node_processor.rb