diff --git a/.travis.yml b/.travis.yml index 31827b8..e2f2db4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ os: - osx rvm: + - 1.8.7 - 1.9.3 - 2.0.0 - 2.1.10 @@ -25,6 +26,9 @@ matrix: - os: osx rvm: 2.0.0 + - os: osx + rvm: 1.8.7 + # include: # - os: osx # rvm: 1.9.3 diff --git a/Gemfile b/Gemfile index 3f1837e..c36df53 100644 --- a/Gemfile +++ b/Gemfile @@ -3,15 +3,21 @@ source "http://rubygems.org/" # @param [Array] versions compatible ruby versions # @return [Array] an array with mri platforms of given versions def mries(*versions) - versions.flat_map do |v| - %w(ruby mingw x64_mingw) - .map { |platform| "#{platform}_#{v}".to_sym unless platform == "x64_mingw" && v < "2.0" } - .delete_if &:nil? - end + versions.map do |v| + %w(ruby mingw x64_mingw).map do |platform| + "#{platform}_#{v}".to_sym unless platform == "x64_mingw" && v < "2.0" + end.delete_if &:nil? + end.flatten +end + +if RUBY_VERSION < '1.9' || defined?(JRUBY_VERSION) + gem "ruby-debug-base", :platforms => [:jruby, *mries('18')] +end + +if RUBY_VERSION && RUBY_VERSION >= "1.9" + gem "ruby-debug-base19x", ">= 0.11.32", :platforms => mries('19') end -gem "ruby-debug-base", :platforms => [:jruby, *mries('18')] -gem "ruby-debug-base19x", ">= 0.11.32", :platforms => mries('19') if RUBY_VERSION && RUBY_VERSION >= "2.0" gem "debase", "~> 0.2", ">= 0.2.2", :platforms => mries('20', '21', '22', '23', '24', '25') end @@ -23,6 +29,10 @@ group :development do end group :test do - gem "test-unit" + if RUBY_VERSION < "1.9" + gem "test-unit", "~> 2.1.2" + else + gem "test-unit" + end end diff --git a/lib/ruby-debug-ide/version.rb b/lib/ruby-debug-ide/version.rb index c47f24f..6bcc59e 100755 --- a/lib/ruby-debug-ide/version.rb +++ b/lib/ruby-debug-ide/version.rb @@ -1,3 +1,3 @@ module Debugger - IDE_VERSION='0.7.0.beta6' + IDE_VERSION='0.7.0.beta7' end diff --git a/lib/ruby-debug-ide/xml_printer.rb b/lib/ruby-debug-ide/xml_printer.rb index 65b8dbf..416be25 100644 --- a/lib/ruby-debug-ide/xml_printer.rb +++ b/lib/ruby-debug-ide/xml_printer.rb @@ -459,8 +459,7 @@ def print_load_result(file, exception = nil) end def print_element(name, additional_tags = nil) - additional_tags_presentation = additional_tags.nil? ? '' - : additional_tags.map {|tag, value| " #{tag}=\"#{value}\""}.reduce(:+) + additional_tags_presentation = additional_tags.nil? ? '' : additional_tags.map {|tag, value| " #{tag}=\"#{value}\""}.reduce(:+) print("<#{name}#{additional_tags_presentation}>") begin diff --git a/test-base/inspect_test.rb b/test-base/inspect_test.rb index c130bc0..c7ff66b 100644 --- a/test-base/inspect_test.rb +++ b/test-base/inspect_test.rb @@ -69,6 +69,10 @@ def test_inspect_expr_with_timeout end def test_inspect_failing_expr_with_timeout + if RUBY_VERSION < "1.9" + @process_finished = true + return + end create_socket ["require 'timeout'", "puts 'test'"] run_to_line(2) send_ruby("v inspect (Timeout::timeout(0.1) { sleep 0.2 })") diff --git a/test-base/test_base.rb b/test-base/test_base.rb index 91cf22d..c026750 100644 --- a/test-base/test_base.rb +++ b/test-base/test_base.rb @@ -132,8 +132,9 @@ def TestBase.find_free_port(port = 1098) end def create_file(script_name, lines) - script_path = File.realdirpath(File.join(TMP_DIR, script_name)) - + file = File.join(TMP_DIR, script_name) + script_path = RUBY_VERSION >= "1.9" ? File.realdirpath(file) : file.to_s + File.open(script_path, "w") do |script| script.printf(lines.join("\n")) end @@ -142,7 +143,9 @@ def create_file(script_name, lines) def create_test2(lines) @test2_name = "test2.rb" - @test2_path = create_file(@test2_name, lines).force_encoding(Encoding::UTF_8) + @test2_path = create_file(@test2_name, lines) + + @test2_path = @test2_path.force_encoding(Encoding::UTF_8) if RUBY_VERSION >= "1.9" end # Creates test.rb with the given lines, set up @test_name and @test_path diff --git a/test-base/variables_test.rb b/test-base/variables_test.rb index 50c1b2d..85a44b3 100644 --- a/test-base/variables_test.rb +++ b/test-base/variables_test.rb @@ -100,7 +100,9 @@ def test_variable_local end def test_variable_instance - create_socket ["require_relative 'test2.rb'", "custom_object=Test2.new", "puts custom_object"] + require_string = RUBY_VERSION < "1.9" ? "require" : "require_relative" + + create_socket ["#{require_string} 'test2.rb'", "custom_object=Test2.new", "puts custom_object"] create_test2 ["class Test2", "def initialize", "@y=5", "end", "def to_s", "'test'", "end", "end"] run_to("test2.rb", 6) frame_number = 3 @@ -130,8 +132,9 @@ def test_variable_hash_with_string_keys assert_variables(read_variables, 1, {:name => "hash", :hasChildren => true}) send_ruby("v i hash") + expected_name = CGI::escapeHTML("'a'") assert_variables(read_variables, 2, - {:name => CGI.escape_html("'a'"), :value => "z", :type => "String"}) + {:name => expected_name, :value => "z", :type => "String"}) send_cont end @@ -228,7 +231,13 @@ def test_new_hash_presentation send_ruby("v i b") - assert_variables(read_variables, 6, + variables = [] + + read_variables.each_slice(2) do |var| + variables << var + end + + assert_variables(variables.sort_by{|a| a[0].value}.flatten, 6, {:name => "key", :value => "1"}, {:name => "value", :value => "A instance", :type => "A"}, @@ -241,6 +250,11 @@ def test_new_hash_presentation end def test_to_s_timelimit + #no TracePointApi for old versions + if RUBY_VERSION <= "1.9" + @process_finished = true + return + end create_socket ['class A', 'def to_s', 'a = 1',