Sha256: e92227b3618e5f33a6e3921bd7142699726b9ca68343f5d0ab1fdd38784b2139

Contents?: true

Size: 1.63 KB

Versions: 10

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby

# begin require 'rubygems' rescue LoadError end
# require 'ruby-debug' ; Debugger.start

require 'test/unit'
SRC_DIR = File.dirname(__FILE__) unless 
  defined?(SRC_DIR)
%w(ext lib cli).each do |dir|
  $: <<  File.join(SRC_DIR, '..', dir)
end
require 'ruby_debug'
require File.join(SRC_DIR, '..', 'cli', 'ruby-debug')

# Test Local Control Interface
class TestCtrl < Test::Unit::TestCase

  def cheap_diff(got_lines, correct_lines, outfile)
    if correct_lines.size != got_lines.size
      puts "Size difference #{correct_lines.size} vs. #{got_lines.size}"
      File.open(outfile, 'w') {|f| f.puts got_lines}
      return false
    end
    correct_lines.each_with_index do |line, i|
      correct_lines[i].chomp!
      if got_lines[i] != correct_lines[i]
        puts "difference found at line #{i+1}"
        puts "got : #{got_lines[i]}"
        puts "need: #{correct_lines[i]}"
        File.open(outfile, 'w') {|f| f.puts got_lines}
        return false
      end
    end
  end

  require 'stringio'

  # Test initial variables and setting/getting state.
  def test_ctrl
    ENV['COLUMNS'] = '80'
    ENV['EMACS'] = nil
    testbase = 'ctrl'
    out = StringIO.new('', 'w')
    Dir.chdir(SRC_DIR) do
      script = File.join('data', "#{testbase}.cmd")
      interface = Debugger::ScriptInterface.new(script, out)
      processor = Debugger::ControlCommandProcessor.new(interface)
      processor.process_commands
      got_lines = out.string.split("\n")
      right_file = File.join('data', "#{testbase}.right")
      correct_lines = File.readlines(right_file)
      assert cheap_diff(got_lines, correct_lines, "#{testbase}.out")
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
ruby-debug-0.10.5.rc1 test/test-ctrl.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/ruby-debug-0.10.4/test/test-ctrl.rb
ruby-debug-0.10.4 test/test-ctrl.rb