Skip to content

Commit

Permalink
Add tests for prelude.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored and ko1 committed Dec 22, 2022
1 parent f42e9c6 commit ef639a2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/console/debugger_method_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,36 @@ def test_step_in_stops_the_program
end
end
end

class PreludeTest < ConsoleTestCase
def program
<<~RUBY
1| require "debug/prelude"
2| debugger_source = Kernel.method(:debugger).source_location
3| a = 100
4| b = 20
5| debugger
6|
7| __END__
RUBY
end

def test_prelude_defines_debugger_statements
run_ruby(program, options: "-Ilib") do
assert_line_num(5)
type "a + b"
assert_line_text(/120/)
type "c"
end
end

def test_prelude_doesnt_override_debugger
run_ruby(program, options: "-Ilib -rdebug") do
assert_line_num(5)
type "debugger_source"
assert_line_text(/debug\/session\.rb/)
type "c"
end
end
end
end

0 comments on commit ef639a2

Please sign in to comment.