Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Set autolist & autoeval by default #72

Merged
merged 3 commits into from

2 participants

@deivid-rodriguez

This is 2/3 of issue #62. Hope it helps.

@cldwalker
Owner

Thanks! I'll look at pulling this in once ruby 2.0 support is sorted out

@deivid-rodriguez

You are welcome! Keep on with the good work, I hope I can pull some bug fixes soon to debugger.

@cldwalker cldwalker merged commit 1876d5e into cldwalker:master

1 check passed

Details default The Travis build passed
@cldwalker
Owner

2.0 is taking longer than expected so I pulled this in. Thanks!

@deivid-rodriguez deivid-rodriguez deleted the deivid-rodriguez:default_autolist branch
@deivid-rodriguez

You are welcome!

@cldwalker cldwalker referenced this pull request from a commit
@deivid-rodriguez deivid-rodriguez Fixes some order dependent failures in test suite.
Introduced in pull request #72.
6f6df01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2013
  1. @deivid-rodriguez
Commits on Apr 9, 2013
  1. @deivid-rodriguez
  2. @deivid-rodriguez

    Accidentally included the dynamic library...

    deivid-rodriguez authored
    It should probably be added to .gitignore so this doesn't happen again
This page is out of date. Refresh to see the latest.
View
25 lib/ruby-debug/commands/eval.rb
@@ -21,7 +21,7 @@ def dbg_puts(*args)
$__dbg_interface = nil
end
end
-
+
class EvalCommand < Command # :nodoc:
register_setting_get(:autoeval) do
EvalCommand.unknown
@@ -30,11 +30,14 @@ class EvalCommand < Command # :nodoc:
EvalCommand.unknown = value
end
+ # Set default value
+ Command.settings[:autoeval] = 1
+
def match(input)
@input = input
super
end
-
+
def regexp
/^\s*(p|e(?:val)?)\s+/
end
@@ -69,7 +72,7 @@ def help(cmd)
class PPCommand < Command # :nodoc:
self.allow_in_control = true
-
+
def regexp
/^\s*pp\s+/
end
@@ -80,7 +83,7 @@ def execute
PP.pp(debug_eval(@match.post_match, b), out)
end
print out.string
- rescue
+ rescue
out.puts $!.message
end
@@ -99,7 +102,7 @@ def help(cmd)
class PutLCommand < Command # :nodoc:
self.allow_in_control = true
-
+
def regexp
/^\s*putl\s+/
end
@@ -116,7 +119,7 @@ def execute
print out.string
end
end
- rescue
+ rescue
out.puts $!.message
end
@@ -132,12 +135,12 @@ def help(cmd)
end
end
end
-
+
class PSCommand < Command # :nodoc:
self.allow_in_control = true
-
+
include EvalFunctions
-
+
def regexp
/^\s*ps\s+/
end
@@ -154,7 +157,7 @@ def execute
print out.string
end
end
- rescue
+ rescue
out.puts $!.message
end
@@ -170,5 +173,5 @@ def help(cmd)
end
end
end
-
+
end
View
3  lib/ruby-debug/commands/list.rb
@@ -9,6 +9,9 @@ class ListCommand < Command
ListCommand.always_run = value
end
+ # Set autolist by default
+ Command.settings[:autolist] = 1
+
def regexp
/^\s* l(?:ist)? (?:\s*([-=])|\s+(.+))? $/x
end
View
12 test/eval_test.rb
@@ -22,13 +22,17 @@
end
describe "autoeval" do
- temporary_change_hash_value(Debugger::Command.settings, :autoeval, false)
-
- it "must eval the expression if no matching command is found" do
- enter 'set autoeval', '[5,6,7].inject(&:+)'
+ it "must eval the expression if no matching command is found by default" do
+ enter '[5,6,7].inject(&:+)'
debug_file 'eval'
check_output_includes "18"
end
+
+ it "must not eval the expression if no matching command is found if toogled" do
+ enter 'set noautoeval', '[5,6,7].inject(&:+)'
+ debug_file 'eval'
+ check_output_doesnt_include "18"
+ end
end
describe "evaluate with error" do
View
12 test/list_test.rb
@@ -55,13 +55,17 @@
end
describe "autolist" do
- temporary_change_hash_value(Debugger::Command.settings, :autolist, 0)
-
- it "must show the surronding lines even without 'list' command if autolist is enabled" do
- enter 'set autolist', 'break 5', 'cont'
+ it "must show the surrounding lines even without 'list' command by default" do
+ enter 'break 5', 'cont'
debug_file 'list'
check_output_includes "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
end
+
+ it "must not show the surronding lines by default when autolist is toggled" do
+ enter 'set noautolist', 'break 5', 'cont'
+ debug_file 'list'
+ check_output_doesnt_include "[4, 6] in #{fullpath('list')}", "4 4", "=> 5 5", "6 6"
+ end
end
describe "specified lines" do
Something went wrong with that request. Please try again.