Sha256: 7cdd1666ce09aa9309c6653eca984dc6b884ef76256c639a86e8bcca5cffcadc

Contents?: true

Size: 1.76 KB

Versions: 8

Compression:

Stored size: 1.76 KB

Contents

require_relative 'test_helper'

describe "Edit Command" do
  include TestDsl

  it "must open an editor with current file and line" do
    temporary_change_hash_value(ENV, "EDITOR", 'editr') do
      Debugger::Edit.any_instance.expects(:system).with("editr +2 #{fullpath('edit')}")
      enter 'edit'
      debug_file 'edit'
    end
  end

  it "must open a default editor with current file and line" do
    temporary_change_hash_value(ENV, "EDITOR", nil) do
      Debugger::Edit.any_instance.expects(:system).with("ex +2 #{fullpath('edit')}")
      enter 'edit'
      debug_file 'edit'
    end
  end

  it "must open an editor with specified file and line" do
    temporary_change_hash_value(ENV, "EDITOR", 'editr') do
      Debugger::Edit.any_instance.expects(:system).with("editr +3 #{fullpath('edit2')}")
      enter "edit #{fullpath('edit2')}:3"
      debug_file 'edit'
    end
  end

  it "must show an error if there is no such line" do
    enter "edit #{fullpath('edit3')}:6"
    debug_file 'edit'
    check_output_includes "File \"#{fullpath('edit3')}\" is not readable.", interface.error_queue
  end

  it "must show an error if there is incorrect syntax" do
    enter "edit blabla"
    debug_file 'edit'
    check_output_includes "Invalid file/line number specification: blabla", interface.error_queue
  end


  describe "Post Mortem" do
    # TODO: This test fails with "Segmentation fault". Probably need to fix it somehow, or forbid this
    # command in the post mortem mode
    it "must work in post-mortem mode"
    #  temporary_change_hash_value(ENV, "EDITOR", 'editr') do
    #    Debugger::Edit.any_instance.expects(:system).with("editr +2 #{fullpath('edit')}")
    #    enter 'cont', "edit #{fullpath('edit')}:2", 'cont'
    #    debug_file "post_mortem"
    #  end
    #end
  end

end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
debugger2-1.0.0.beta2 test/edit_test.rb
debugger2-1.0.0.beta1 test/edit_test.rb
needy_debugger-1.4.0 test/edit_test.rb
debugger-1.4.0 test/edit_test.rb
debugger-1.3.3 test/edit_test.rb
debugger-1.3.2 test/edit_test.rb
debugger-1.3.1 test/edit_test.rb
debugger-1.3.0 test/edit_test.rb