require_relative 'test_helper' describe "Variables Command" do include TestDsl temporary_change_method_value(Debugger, :printer, Printers::Xml.new) describe "constants" do it "must show constants" do enter 'break 25', 'cont', 'var const VariablesExample' debug_file 'variables' check_output_includes(Regexp.new( '' + %{} + '' )) end end describe "globals" do it "must show global variables" do enter 'break 25', 'cont', 'var global' debug_file 'variables' check_output_includes(Regexp.new( ".*" + %{} + ".*" )) end end describe "instance variables" do it "must show instance variables of the given object" do enter 'break 22', 'cont', 'var instance a' debug_file 'variables_xml' [ %{}, %{}, %{}, %{}, %{} ].each do |regexp_string| check_output_includes(Regexp.new(regexp_string)) end end it "must show array" do enter 'break 23', 'cont', ->{"var instance #{eval('"%#+x" % b.object_id', binding)}"} debug_file 'variables_xml' check_output_includes( "" + %{} + %{} + %{} + "" ) end it "must show hash" do enter 'break 24', 'cont', ->{"var instance #{eval('"%#+x" % c.object_id', binding)}"} debug_file 'variables_xml' check_output_includes(Regexp.new( "" + %{} + %{} + "" )) end end describe "local variables" do it "must show local variables" do enter 'break 17', 'cont', 'var local' debug_file 'variables' check_output_includes(Regexp.new( "" + %{} + %{} + %{} + %{} + "" )) end end end