Skip to content

Commit

Permalink
Bang on integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Feb 6, 2015
1 parent 94edce8 commit 197a019
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 35 deletions.
5 changes: 5 additions & 0 deletions Rakefile
Expand Up @@ -146,6 +146,11 @@ task :'check:functional' do
run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test functional)))
end

desc 'Run integration tests in standalone mode.'
task :'check:functional' do
run_standalone_ruby_file(File.join(%W(#{ROOT_DIR} test ingtegration)))
end

desc 'Run command parser grammar.'
task :'check:cmd_parse' do
sh "kpeg --test --debug #{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))}"
Expand Down
10 changes: 6 additions & 4 deletions test/data/debugger-stop.right
@@ -1,6 +1,8 @@
-- debugger-stop.rb:14 @1955)
line debugger-stop.rb:14 @1955)
require_relative '../../lib/trepanning'
line debugger-stop.rb:10 @1954
Foo::five
(trepan): Program stop event: line; PC offset 100 <top debugger-stop.rb>
-- debugger-stop.rb:10 @1954)
5
trepan: That's all, folks...
Program terminated, type q to quit
:/
(trepan:pm): trepan: That's all, folks...
2 changes: 1 addition & 1 deletion test/data/fname-with-blank.cmd
Expand Up @@ -3,4 +3,4 @@
# *******************************************************************
set basename off
continue

quit!
5 changes: 5 additions & 0 deletions test/data/fname-with-blank.right
@@ -1 +1,6 @@
-> (fname with blank.rb:1 @0)
puts "Ha!"
basename is off.
Ha!
Program terminated, type q to quit
trepan: That's all, folks...
1 change: 0 additions & 1 deletion test/data/pc.cmd
Expand Up @@ -5,5 +5,4 @@ info reg pc
set register pc 13
step
info reg pc
va
quit!
4 changes: 3 additions & 1 deletion test/data/quit.right
@@ -1 +1,3 @@
-> (null.rb:1 @0)
line (null.rb:2 @2)
x = 1
trepan: That's all, folks...
14 changes: 7 additions & 7 deletions test/integration/test-debugger-stop.rb
Expand Up @@ -5,23 +5,23 @@

class TestDebuggerStop < Test::Unit::TestCase
@@name = File.basename(__FILE__, '.rb')[5..-1]
@@name = @@name[2..-1] if
@@name = @@name[2..-1] if
(RbConfig::CONFIG['target_os'].start_with?('mingw') and
@@name =~ /^[A-Za-z]:/)

def test_it
skip "FIXME for mingw" if
RbConfig::CONFIG['target_os'].start_with?('mingw')
skip "FIXME for mingw" if
RbConfig::CONFIG['target_os'].start_with?('mingw')
opts = {}
opts[:feed_input] = "echo 'info program ;; continue ;; quit!' "
opts[:filter] = Proc.new{|got_lines, correct_lines|
got_lines[0].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+/,
got_lines[0].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+/,
'debugger-stop.rb:14 @1955')
# require_relative '../../lib/trepanning'; debugger
got_lines[2].gsub!(/PC offset \d+ .*<top .+debugger-stop.rb/,
"PC offset 100 <top debugger-stop.rb")
got_lines[3].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+/,
got_lines[2].gsub!(/\(.*debugger-stop.rb[:]\d+ @\d+\)/,
'debugger-stop.rb:10 @1954')
got_lines[4].gsub!(/PC offset \d+ .*<top .+debugger-stop.rb/,
"PC offset 100 <top debugger-stop.rb")
}
assert_equal(true, run_debugger(@@name, @@name + '.rb', opts))
end
Expand Down
13 changes: 7 additions & 6 deletions test/integration/test-pc.rb
Expand Up @@ -13,11 +13,12 @@ class TestQuit < Test::Unit::TestCase
# assert_equal(true, run_debugger('quit2', 'null.rb', opts))
# end

def test_trepan_call
opts = {}
opts[:filter] = Proc.new{|got_lines, correct_lines|
got_lines[0] = "-> (null.rb:1 @0)\n"
}
assert_equal(true, run_debugger(@@NAME, 'assign.rb', opts))
def test_trepan_pc
skip "Can't run from rake :-(" if __FILE__ != $0
opts = {}
opts[:filter] = Proc.new{|got_lines, correct_lines|
got_lines[0] = "-> (null.rb:1 @0)\n"
}
assert_equal(true, run_debugger(@@NAME, 'assign.rb', opts))
end
end
31 changes: 16 additions & 15 deletions test/integration/test-quit.rb
Expand Up @@ -3,21 +3,22 @@
require_relative 'helper'

class TestQuit < Test::Unit::TestCase
@@NAME = File.basename(__FILE__, '.rb')[5..-1]
@@NAME = File.basename(__FILE__, '.rb')[5..-1]

# def test_trepanx_set_confirm_off
# opts = {}
# opts[:filter] = Proc.new{|got_lines, correct_lines|
# got_lines[0] = "-> (null.rb:1 @0)\n"
# }
# assert_equal(true, run_debugger('quit2', 'null.rb', opts))
# end
# def test_trepanx_set_confirm_off
# opts = {}
# opts[:filter] = Proc.new{|got_lines, correct_lines|
# got_lines[0] = "-> (null.rb:1 @0)\n"
# }
# assert_equal(true, run_debugger('quit2', 'null.rb', opts))
# end

def test_trepan_call
opts = {}
opts[:filter] = Proc.new{|got_lines, correct_lines|
got_lines[0] = "-> (null.rb:1 @0)\n"
}
assert_equal(true, run_debugger(@@NAME, 'null.rb', opts))
end
def test_trepan_quit
skip "Can't run from rake" if __FILE__ != $0
opts = {}
opts[:filter] = Proc.new{|got_lines, correct_lines|
got_lines[0] = "-> (null.rb:1 @0)\n"
}
assert_equal(true, run_debugger(@@NAME, 'null.rb', opts))
end
end

0 comments on commit 197a019

Please sign in to comment.