byebug 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,14 +69,14 @@ class TestSet < TestDsl::TestCase
69
69
  end
70
70
 
71
71
  describe 'testing' do
72
- describe '$byebug_state' do
72
+ describe '$state' do
73
73
  describe 'when setting "testing" to on' do
74
74
  temporary_change_hash Byebug::Command.settings, :testing, false
75
75
 
76
76
  it 'must get set' do
77
77
  enter 'set testing', 'break 3', 'cont'
78
78
  debug_file('set') {
79
- $byebug_state.must_be_kind_of Byebug::CommandProcessor::State }
79
+ $state.must_be_kind_of Byebug::CommandProcessor::State }
80
80
  end
81
81
  end
82
82
 
@@ -85,7 +85,7 @@ class TestSet < TestDsl::TestCase
85
85
 
86
86
  it 'must get unset' do
87
87
  enter 'set notesting', 'break 3', 'cont'
88
- debug_file('set') { $byebug_state.must_be_nil }
88
+ debug_file('set') { $state.must_be_nil }
89
89
  end
90
90
  end
91
91
  end
@@ -81,7 +81,7 @@ class TestShow < TestDsl::TestCase
81
81
  it 'must show default value' do
82
82
  enter 'show callstyle'
83
83
  debug_file 'show'
84
- check_output_includes 'Frame call-display style is last.'
84
+ check_output_includes 'Frame call-display style is long.'
85
85
  end
86
86
  end
87
87
 
@@ -11,17 +11,17 @@ class TestStepping < TestDsl::TestCase
11
11
 
12
12
  it 'must leave on the same line by default' do
13
13
  enter 'next'
14
- debug_file('stepping') { state.line.must_equal 10 }
14
+ debug_file('stepping') { $state.line.must_equal 10 }
15
15
  end
16
16
 
17
17
  it 'must go to the next line if forced by "plus" sign' do
18
18
  enter 'next+'
19
- debug_file('stepping') { state.line.must_equal 11 }
19
+ debug_file('stepping') { $state.line.must_equal 11 }
20
20
  end
21
21
 
22
22
  it 'must leave on the same line if forced by "minus" sign' do
23
23
  enter 'next-'
24
- debug_file('stepping') { state.line.must_equal 10 }
24
+ debug_file('stepping') { $state.line.must_equal 10 }
25
25
  end
26
26
 
27
27
  describe 'when force_stepping is set' do
@@ -29,22 +29,22 @@ class TestStepping < TestDsl::TestCase
29
29
 
30
30
  it 'must go to the next line' do
31
31
  enter 'next'
32
- debug_file('stepping') { state.line.must_equal 11 }
32
+ debug_file('stepping') { $state.line.must_equal 11 }
33
33
  end
34
34
 
35
35
  it 'must go to the next line (by shortcut)' do
36
36
  enter 'n'
37
- debug_file('stepping') { state.line.must_equal 11 }
37
+ debug_file('stepping') { $state.line.must_equal 11 }
38
38
  end
39
39
 
40
40
  it 'must go the specified number of lines forward by default' do
41
41
  enter 'next 2'
42
- debug_file('stepping') { state.line.must_equal 21 }
42
+ debug_file('stepping') { $state.line.must_equal 21 }
43
43
  end
44
44
 
45
45
  it 'must ignore it if "minus" is specified' do
46
46
  enter 'next-'
47
- debug_file('stepping') { state.line.must_equal 10 }
47
+ debug_file('stepping') { $state.line.must_equal 10 }
48
48
  end
49
49
  end
50
50
  end
@@ -54,7 +54,7 @@ class TestStepping < TestDsl::TestCase
54
54
 
55
55
  it 'must step over blocks' do
56
56
  enter 'next'
57
- debug_file('stepping') { state.line.must_equal 25 }
57
+ debug_file('stepping') { $state.line.must_equal 25 }
58
58
  end
59
59
  end
60
60
 
@@ -82,17 +82,17 @@ class TestStepping < TestDsl::TestCase
82
82
 
83
83
  it 'must leave on the same line if forced by a setting' do
84
84
  enter 'step'
85
- debug_file('stepping') { state.line.must_equal 10 }
85
+ debug_file('stepping') { $state.line.must_equal 10 }
86
86
  end
87
87
 
88
88
  it 'must go to the step line if forced to do that by "plus" sign' do
89
89
  enter 'step+'
90
- debug_file('stepping') { state.line.must_equal 11 }
90
+ debug_file('stepping') { $state.line.must_equal 11 }
91
91
  end
92
92
 
93
93
  it 'must leave on the same line if forced to do that by "minus" sign' do
94
94
  enter 'step-'
95
- debug_file('stepping') { state.line.must_equal 10 }
95
+ debug_file('stepping') { $state.line.must_equal 10 }
96
96
  end
97
97
 
98
98
  describe 'when force_stepping is set' do
@@ -100,17 +100,17 @@ class TestStepping < TestDsl::TestCase
100
100
 
101
101
  it 'must go to the step line if forced by a setting' do
102
102
  enter 'step'
103
- debug_file('stepping') { state.line.must_equal 11 }
103
+ debug_file('stepping') { $state.line.must_equal 11 }
104
104
  end
105
105
 
106
106
  it 'must go to the next line if forced by a setting (by shortcut)' do
107
107
  enter 's'
108
- debug_file('stepping') { state.line.must_equal 11 }
108
+ debug_file('stepping') { $state.line.must_equal 11 }
109
109
  end
110
110
 
111
111
  it 'must go the specified number of lines forward by default' do
112
112
  enter 'step 2'
113
- debug_file('stepping') { state.line.must_equal 15 }
113
+ debug_file('stepping') { $state.line.must_equal 15 }
114
114
  end
115
115
  end
116
116
  end
@@ -120,10 +120,9 @@ class TestStepping < TestDsl::TestCase
120
120
 
121
121
  it 'must step into blocks' do
122
122
  enter 'step'
123
- debug_file('stepping') { state.line.must_equal 22 }
123
+ debug_file('stepping') { $state.line.must_equal 22 }
124
124
  end
125
125
  end
126
-
127
126
  end
128
127
 
129
128
  describe 'Post Mortem' do
@@ -1,6 +1,12 @@
1
1
  module TestDsl
2
2
 
3
- class TestBase < MiniTest::Spec
3
+ class TestCase < MiniTest::Spec
4
+ include TestDsl
5
+
6
+ def setup
7
+ Byebug.interface = TestInterface.new
8
+ Byebug.handler.display.clear
9
+ end
4
10
 
5
11
  def self.temporary_change_hash hash, key, value
6
12
  before do
@@ -36,15 +42,6 @@ module TestDsl
36
42
  end
37
43
  end
38
44
 
39
- class TestCase < TestBase
40
- include TestDsl
41
-
42
- def setup
43
- Byebug.interface = TestInterface.new
44
- Byebug.handler.display.clear
45
- end
46
- end
47
-
48
45
  ##
49
46
  # Expand fullpath of a given example file
50
47
  #
@@ -83,7 +80,7 @@ module TestDsl
83
80
  # debug "ex1" # ex1 should be placed in test/examples/ex1.rb
84
81
  #
85
82
  # enter 'b 4', 'cont'
86
- # debug("ex1") { state.line.must_equal 4 }
83
+ # debug("ex1") { $state.line.must_equal 4 }
87
84
  #
88
85
  def debug_file(filename, &block)
89
86
  is_test_block_called = false
@@ -148,12 +145,8 @@ module TestDsl
148
145
  Byebug.handler.interface
149
146
  end
150
147
 
151
- def state
152
- $byebug_state
153
- end
154
-
155
148
  def context
156
- $byebug_state.context
149
+ $state.context
157
150
  end
158
151
 
159
152
  def force_set_const(klass, const, value)
@@ -84,12 +84,12 @@ class TestTrace < TestDsl::TestCase
84
84
 
85
85
  it 'must track global variable with stop' do
86
86
  enter 'trace variable $bla stop', 'break 7', 'cont'
87
- debug_file('trace') { state.line.must_equal 4 }
87
+ debug_file('trace') { $state.line.must_equal 4 }
88
88
  end
89
89
 
90
90
  it 'must track global variable with nostop' do
91
91
  enter 'trace variable $bla nostop', 'break 7', 'cont'
92
- debug_file('trace') { state.line.must_equal 7 }
92
+ debug_file('trace') { $state.line.must_equal 7 }
93
93
  end
94
94
 
95
95
  describe 'errors' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-21 00:00:00.000000000 Z
13
+ date: 2013-07-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: columnize
@@ -163,8 +163,9 @@ files:
163
163
  - test/display_test.rb
164
164
  - test/edit_test.rb
165
165
  - test/eval_test.rb
166
- - test/examples/breakpoint1.rb
166
+ - test/examples/breakpoint.rb
167
167
  - test/examples/breakpoint2.rb
168
+ - test/examples/breakpoint_deep.rb
168
169
  - test/examples/conditions.rb
169
170
  - test/examples/continue.rb
170
171
  - test/examples/display.rb
@@ -216,7 +217,6 @@ files:
216
217
  - test/support/breakpoint.rb
217
218
  - test/support/context.rb
218
219
  - test/support/matchers.rb
219
- - test/support/mocha_extensions.rb
220
220
  - test/support/processor.rb
221
221
  - test/support/test_dsl.rb
222
222
  - test/support/test_interface.rb
@@ -254,8 +254,9 @@ test_files:
254
254
  - test/display_test.rb
255
255
  - test/edit_test.rb
256
256
  - test/eval_test.rb
257
- - test/examples/breakpoint1.rb
257
+ - test/examples/breakpoint.rb
258
258
  - test/examples/breakpoint2.rb
259
+ - test/examples/breakpoint_deep.rb
259
260
  - test/examples/conditions.rb
260
261
  - test/examples/continue.rb
261
262
  - test/examples/display.rb
@@ -307,7 +308,6 @@ test_files:
307
308
  - test/support/breakpoint.rb
308
309
  - test/support/context.rb
309
310
  - test/support/matchers.rb
310
- - test/support/mocha_extensions.rb
311
311
  - test/support/processor.rb
312
312
  - test/support/test_dsl.rb
313
313
  - test/support/test_interface.rb
@@ -1,71 +0,0 @@
1
- module Mocha
2
-
3
- class Expectation
4
- # Allows to specify a block to execute when expectation will be matched.
5
- # This way, we can specify dynamic values to return or just make some side effects
6
- #
7
- # Example:
8
- # foo.expects(:bar).with('bla').calls { 2 + 3 }
9
- # foo.bar('bla') # => 5
10
- #
11
- def calls(&block)
12
- @calls ||= Call.new
13
- @calls += Call.new(block)
14
- self
15
- end
16
-
17
- def invoke_with_calls(arguments, &block)
18
- invoke_without_calls(&block) || (@calls.next(arguments, &block) if @calls)
19
- end
20
- alias_method :invoke_without_calls, :invoke
21
- alias_method :invoke, :invoke_with_calls
22
- end
23
-
24
-
25
- class Mock
26
- # We monkey-patch that method to be able to pass arguments to
27
- # Expectation#invoke method
28
- def method_missing(symbol, *arguments, &block)
29
- if @responder and not @responder.respond_to?(symbol)
30
- raise NoMethodError,
31
- "undefined method `#{symbol}' for #{self.mocha_inspect} which " \
32
- "responds like #{@responder.mocha_inspect}"
33
- end
34
- if matching_expectation_allowing_invocation =
35
- @expectations.match_allowing_invocation(symbol, *arguments)
36
- # We change this line - added arguments
37
- matching_expectation_allowing_invocation.invoke(arguments, &block)
38
- elsif (matching_expectation = @expectations.match(symbol, *arguments)) ||
39
- (!matching_expectation && !@everything_stubbed)
40
- # We change this line - added arguments
41
- matching_expectation.invoke(arguments, &block) if matching_expectation
42
- message = UnexpectedInvocation.new(self, symbol, *arguments).to_s
43
- require 'mocha/mockery'
44
- message << Mockery.instance.mocha_inspect
45
- raise ExpectationError.new(message, caller)
46
- end
47
- end
48
- end
49
-
50
-
51
- class Call
52
- attr_reader :blocks
53
-
54
- def initialize(*blocks)
55
- @blocks = [ *blocks ]
56
- end
57
-
58
- def next(arguments, &block)
59
- case @blocks.length
60
- when 0 then nil
61
- when 1 then @blocks.first.call(*arguments, &block)
62
- else @blocks.shift.call(*arguments, &block)
63
- end
64
- end
65
-
66
- def +(other)
67
- self.class.new(*(@blocks + other.blocks))
68
- end
69
- end
70
-
71
- end