diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7d7f8b36..26121b2db 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -364,6 +364,14 @@ Passes if result of `expression` is equal to `expected`. Passes if `expected` is equal to the location where debugger stops. +- assert_locals_result(expected) + +Passes if all of `expected` local variable entries match the ones returned by debugger. + +An variable entry looks like this: `{ name: "bar", value: "nil", type: "NilClass" }`. + +Please note that both `value` and `type` need to be strings. + ## To Update README diff --git a/test/protocol/break_test.rb b/test/protocol/break_test.rb index 1a65bdf04..f3cfe6d83 100644 --- a/test/protocol/break_test.rb +++ b/test/protocol/break_test.rb @@ -15,15 +15,30 @@ class BreakTest1 < TestCase 8| bar = Bar.new 9| end RUBY - + def test_break_stops_at_correct_place run_protocol_scenario PROGRAM do req_add_breakpoint 5 req_continue assert_line_num 5 - req_add_breakpoint 8 + + assert_locals_result( + [ + { name: "%self", value: "Foo::Bar", type: "Class" }, + { name: "_return", value: "hello", type: "String" } + ] + ) + + req_add_breakpoint 9 req_continue - assert_line_num 8 + assert_line_num 9 + + assert_locals_result( + [ + { name: "%self", value: "Foo", type: "Module" }, + { name: "bar", value: /#