Sha256: e78fd5228f5c65bb6a5bb0a7d7bc1887d3d7a95ac36a935d3dd8b5059ec10a1c

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require_relative 'test_helper'

class TestSource < TestDsl::TestCase

  before { File.open(filename, 'w') do |f|
             f.puts 'break 2'
             f.puts 'break 3 if true'
           end }

  after { FileUtils.rm(filename) }

  let(:filename) { 'source_example.txt' }

  it 'must run commands from file' do
    enter "source #{filename}"
    debug_file 'source' do
      Byebug.breakpoints[0].pos.must_equal 2
      Byebug.breakpoints[1].pos.must_equal 3
      Byebug.breakpoints[1].expr.must_equal 'true'
    end
  end

  it 'must be able to use shortcut' do
    enter "so #{filename}"
    debug_file('source') { Byebug.breakpoints[0].pos.must_equal 2 }
  end

  it 'must show an error if file is not found' do
    enter 'source blabla'
    debug_file 'source'
    check_error_includes /File ".*blabla" not found/
  end

  describe 'Help' do
    it 'must show help when used without arguments' do
      enter 'source'
      debug_file 'source'
      check_output_includes \
        "source FILE\texecutes a file containing byebug commands"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
byebug-2.1.1 test/source_test.rb
byebug-2.1.0 test/source_test.rb
byebug-2.0.0 test/source_test.rb