Skip to content

Commit

Permalink
Merge pull request #298 from deivid-rodriguez/dev_updates
Browse files Browse the repository at this point in the history
Dev updates
  • Loading branch information
David Rodríguez authored Nov 6, 2016
2 parents 5fd6cef + 27be6d4 commit ba17b31
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 92 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ before_script:

script:
- bundle exec rake clobber compile test sign_hooks overcommit
- bundle exec codeclimate-test-reporter

rvm:
- 2.1.10
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ gemspec

gem 'rake', '~> 11.1'
gem 'rake-compiler', '~> 1.0'
gem 'rubocop', '0.43.0'
gem 'rubocop', '0.45.0'
gem 'minitest', '~> 5.7'
gem 'simplecov', '0.12.0'
gem 'codeclimate-test-reporter', '0.6.0'
gem 'overcommit', '0.36.0'
gem 'codeclimate-test-reporter', '~> 1.0'
gem 'overcommit', '0.37.0'
gem 'mdl', '0.4.0'
gem 'pry', git: 'https://github.com/pry/pry'
gem 'travis', '~> 1.8'
Expand Down
23 changes: 12 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/pry/pry
revision: ce8c4b5137d0f14f2aa1c7a83b4706c5c798cead
revision: 285374b15a09f14b89687c5ee4c227249390ddc5
specs:
pry (0.10.4)
coderay (~> 1.1.0)
Expand All @@ -22,11 +22,11 @@ GEM
octokit (>= 2.2.0)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
codeclimate-test-reporter (0.6.0)
simplecov (>= 0.7.1, < 1.0.0)
codeclimate-test-reporter (1.0.0)
coderay (1.1.1)
connection_pool (2.2.0)
docile (1.1.5)
ethon (0.9.0)
ethon (0.9.1)
ffi (>= 1.3.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
Expand Down Expand Up @@ -56,12 +56,13 @@ GEM
mixlib-config (2.2.4)
multi_json (1.12.1)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
net-http-persistent (3.0.0)
connection_pool (~> 2.2)
net-http-pipeline (1.0.1)
netrc (0.11.0)
octokit (4.3.0)
sawyer (~> 0.7.0, >= 0.5.3)
overcommit (0.36.0)
overcommit (0.37.0)
childprocess (~> 0.5.8)
iniparse (~> 1.4)
parser (2.3.1.4)
Expand All @@ -74,7 +75,7 @@ GEM
rake (11.3.0)
rake-compiler (1.0.1)
rake
rubocop (0.43.0)
rubocop (0.45.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
Expand Down Expand Up @@ -111,17 +112,17 @@ DEPENDENCIES
bundler (~> 1.7)
byebug!
chandler (= 0.3.1)
codeclimate-test-reporter (= 0.6.0)
codeclimate-test-reporter (~> 1.0)
mdl (= 0.4.0)
minitest (~> 5.7)
overcommit (= 0.36.0)
overcommit (= 0.37.0)
pry!
rake (~> 11.1)
rake-compiler (~> 1.0)
rubocop (= 0.43.0)
rubocop (= 0.45.0)
simplecov (= 0.12.0)
travis (~> 1.8)
yard (= 0.9.5)

BUNDLED WITH
1.13.5
1.13.6
4 changes: 2 additions & 2 deletions lib/byebug/helpers/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module FileHelper
# Reads lines of source file +filename+ into an array
#
def get_lines(filename)
File.foreach(filename).reduce([]) { |a, e| a << e.chomp }
File.foreach(filename).reduce([]) { |acc, elem| acc << elem.chomp }
end

#
Expand All @@ -26,7 +26,7 @@ def get_line(filename, lineno)
# one-line-at-a-time way.
#
def n_lines(filename)
File.foreach(filename).reduce(0) { |a, _e| a + 1 }
File.foreach(filename).reduce(0) { |acc, _elem| acc + 1 }
end

#
Expand Down
112 changes: 59 additions & 53 deletions test/commands/history_test.rb
Original file line number Diff line number Diff line change
@@ -1,73 +1,79 @@
require 'test_helper'

module Byebug
#
# Tests Byebug's command line history.
#
class HistoryTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: byebug
3:
4: a = 2
5: a + 3
6: end
EOC
end
unless ENV['LIBEDIT']
module Byebug
#
# Tests Byebug's command line history.
#
class HistoryTest < TestCase
def program
strip_line_numbers <<-EOC
1: module Byebug
2: byebug
3:
4: a = 2
5: a + 3
6: end
EOC
end

def test_history_displays_latest_records_from_readline_history
enter 'show', 'history'
debug_code(program)
def test_history_displays_latest_records_from_readline_history
enter 'show', 'history'
debug_code(program)

check_output_includes(/\d+ show$/, /\d+ history$/)
end
check_output_includes(/\d+ show$/, /\d+ history$/)
end

def test_history_n_displays_whole_history_if_n_is_bigger_than_history_size
enter 'show', 'history 3'
debug_code(program)
def test_history_n_displays_whole_history_if_n_is_bigger_than_history_size
enter 'show', 'history 3'
debug_code(program)

check_output_includes(/\d+ show$/, /\d+ history 3$/)
end
check_output_includes(/\d+ show$/, /\d+ history 3$/)
end

def test_history_n_displays_lastest_n_records_from_readline_history
enter 'show width', 'show autolist', 'history 2'
debug_code(program)
def test_history_n_displays_lastest_n_records_from_readline_history
enter 'show width', 'show autolist', 'history 2'
debug_code(program)

check_output_includes(/\d+ show autolist$/, /\d+ history 2$/)
end
check_output_includes(/\d+ show autolist$/, /\d+ history 2$/)
end

def test_history_does_not_save_empty_commands
enter 'show', 'show width', '', 'history 3'
debug_code(program)
def test_history_does_not_save_empty_commands
enter 'show', 'show width', '', 'history 3'
debug_code(program)

check_output_includes(/\d+ show$/, /\d+ show width$/, /\d+ history 3$/)
end
check_output_includes(
/\d+ show$/, /\d+ show width$/, /\d+ history 3$/
)
end

def test_history_does_not_save_duplicated_consecutive_commands
enter 'show', 'show width', 'show width', 'history 3'
debug_code(program)
def test_history_does_not_save_duplicated_consecutive_commands
enter 'show', 'show width', 'show width', 'history 3'
debug_code(program)

check_output_includes(/\d+ show$/, /\d+ show width$/, /\d+ history 3$/)
end
check_output_includes(
/\d+ show$/, /\d+ show width$/, /\d+ history 3$/
)
end

def test_cmds_from_previous_repls_are_remembered_if_autosave_enabled
with_setting :autosave, true do
enter 'next', 'history 2'
debug_code(program)
def test_cmds_from_previous_repls_are_remembered_if_autosave_enabled
with_setting :autosave, true do
enter 'next', 'history 2'
debug_code(program)

check_output_includes(/\d+ next$/, /\d+ history 2$/)
check_output_includes(/\d+ next$/, /\d+ history 2$/)
end
end
end

def test_cmds_from_previous_repls_are_not_remembered_if_autosave_disabled
with_setting :autosave, false do
enter 'next', 'history'
debug_code(program)
def test_cmds_from_previous_repls_are_not_remembered_if_autosave_disabled
with_setting :autosave, false do
enter 'next', 'history'
debug_code(program)

check_output_includes(/\d+ history$/)
check_output_doesnt_include(/\d+ next$/)
check_output_includes(/\d+ history$/)
check_output_doesnt_include(/\d+ next$/)
end
end
end
end unless ENV['LIBEDIT']
end
end
34 changes: 18 additions & 16 deletions test/commands/where_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,25 @@ def test_where_displays_backtraces_using_short_callstyle
# @note We skip this tests in Windows since the paths in this CI environment
# are usually very deeply nested.
#
class WhereWithNotDeeplyNestedPathsTest < WhereStandardTest
def test_where_displays_current_backtrace_w_shorpaths_if_fullpath_disabled
enter 'set nofullpath', 'where', 'set fullpath'
debug_code(program)

expected_output = prepare_for_regexp <<-TXT
--> #0 #{example_full_class}.to_int(str#String) at #{example_path}:16
#1 #{example_full_class}.encode(str#String) at #{example_path}:11
#2 #{example_full_class}.initialize(l#String) at #{example_path}:7
ͱ-- #3 Class.new(*args) at #{example_path}:20
#4 <module:Byebug> at #{example_path}:20
#5 <top (required)> at #{example_path}:1
TXT

check_output_includes(*expected_output)
unless /cygwin|mswin|mingw/ =~ RUBY_PLATFORM
class WhereWithNotDeeplyNestedPathsTest < WhereStandardTest
def test_where_displays_current_backtrace_w_shorpaths_if_fullpath_disabled
enter 'set nofullpath', 'where', 'set fullpath'
debug_code(program)

expected_output = prepare_for_regexp <<-TXT
--> #0 #{example_full_class}.to_int(str#String) at #{example_path}:16
#1 #{example_full_class}.encode(str#String) at #{example_path}:11
#2 #{example_full_class}.initialize(l#String) at #{example_path}:7
ͱ-- #3 Class.new(*args) at #{example_path}:20
#4 <module:Byebug> at #{example_path}:20
#5 <top (required)> at #{example_path}:1
TXT

check_output_includes(*expected_output)
end
end
end unless /cygwin|mswin|mingw/ =~ RUBY_PLATFORM
end

#
# Tests dealing with backtraces when the path being debugged is deeply nested.
Expand Down
8 changes: 1 addition & 7 deletions test/support/coverage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
def start_coverage_tracking
require 'simplecov'
SimpleCov.add_filter 'test'

if ENV['CI']
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
else
SimpleCov.start
end
SimpleCov.start
end

start_coverage_tracking if ENV['NOCOV'].nil?

0 comments on commit ba17b31

Please sign in to comment.