minitest-debugger 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +2 -0
- data/.autotest +26 -0
- data/History.txt +6 -0
- data/Manifest.txt +7 -0
- data/README.txt +81 -0
- data/Rakefile +29 -0
- data/example.rb +28 -0
- data/lib/minitest/debugger.rb +45 -0
- metadata +143 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
data/.autotest
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "autotest/restart"
|
4
|
+
|
5
|
+
Autotest.add_hook :initialize do |at|
|
6
|
+
at.testlib = "minitest/autorun"
|
7
|
+
at.add_exception "tmp"
|
8
|
+
|
9
|
+
# at.extra_files << "../some/external/dependency.rb"
|
10
|
+
#
|
11
|
+
# at.libs << ":../some/external"
|
12
|
+
#
|
13
|
+
# at.add_exception "vendor"
|
14
|
+
#
|
15
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
16
|
+
# at.files_matching(/test_.*rb$/)
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# %w(TestA TestB).each do |klass|
|
20
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
21
|
+
# end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Autotest.add_hook :run_command do |at|
|
25
|
+
# system "rake build"
|
26
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
= minitest-debugger
|
2
|
+
|
3
|
+
home :: https://github.com/seattlerb/minitest-debugger
|
4
|
+
rdoc :: http://docs.seattlerb.org/minitest-debugger
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
This is a stupid simple example of how easy it is to make a minitest
|
9
|
+
plugin that does something useful. In this case it wraps assert so
|
10
|
+
that failed assertions will drop into the ruby debugger.
|
11
|
+
|
12
|
+
== FEATURES/PROBLEMS:
|
13
|
+
|
14
|
+
* Failed assertions drop into the debugger.
|
15
|
+
* Unhandled exceptions already drop into the debugger.
|
16
|
+
|
17
|
+
== SYNOPSIS:
|
18
|
+
|
19
|
+
Add this to the top of your test file or helper:
|
20
|
+
|
21
|
+
require 'minitest/debugger' if ENV['DEBUG']
|
22
|
+
|
23
|
+
Then run your tests as normal but define DEBUG=1:
|
24
|
+
|
25
|
+
% DEBUG=1 rake test
|
26
|
+
Debug.rb
|
27
|
+
Emacs support available.
|
28
|
+
|
29
|
+
Run options: --seed 27343
|
30
|
+
|
31
|
+
# Running tests:
|
32
|
+
|
33
|
+
.Assertion Failed. Dropping into debugger now:
|
34
|
+
./lib/minitest/debugger.rb:40:
|
35
|
+
(rdb:1) up 2
|
36
|
+
#3 example.rb:18:in `test_assert_failure'
|
37
|
+
(rdb:1) l
|
38
|
+
[13, 22] in example.rb
|
39
|
+
13 def wrong
|
40
|
+
14 24
|
41
|
+
15 end
|
42
|
+
16
|
43
|
+
17 def test_assert_failure
|
44
|
+
=> 18 assert_equal 42, wrong
|
45
|
+
19 end
|
46
|
+
20
|
47
|
+
21 def bad
|
48
|
+
22 raise "no"
|
49
|
+
|
50
|
+
== REQUIREMENTS:
|
51
|
+
|
52
|
+
* minitest... you probably already have it
|
53
|
+
|
54
|
+
== INSTALL:
|
55
|
+
|
56
|
+
* sudo gem install minitest-debugger
|
57
|
+
|
58
|
+
== LICENSE:
|
59
|
+
|
60
|
+
(The MIT License)
|
61
|
+
|
62
|
+
Copyright (c) Ryan Davis, seattle.rb
|
63
|
+
|
64
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
65
|
+
a copy of this software and associated documentation files (the
|
66
|
+
'Software'), to deal in the Software without restriction, including
|
67
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
68
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
69
|
+
permit persons to whom the Software is furnished to do so, subject to
|
70
|
+
the following conditions:
|
71
|
+
|
72
|
+
The above copyright notice and this permission notice shall be
|
73
|
+
included in all copies or substantial portions of the Software.
|
74
|
+
|
75
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
76
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
77
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
78
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
79
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
80
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
81
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "hoe"
|
5
|
+
|
6
|
+
Hoe.plugin :isolate
|
7
|
+
Hoe.plugin :seattlerb
|
8
|
+
|
9
|
+
# Hoe.plugin :compiler
|
10
|
+
# Hoe.plugin :doofus
|
11
|
+
# Hoe.plugin :email
|
12
|
+
# Hoe.plugin :gem_prelude_sucks
|
13
|
+
# Hoe.plugin :git
|
14
|
+
# Hoe.plugin :inline
|
15
|
+
# Hoe.plugin :isolate
|
16
|
+
# Hoe.plugin :minitest
|
17
|
+
# Hoe.plugin :minitest
|
18
|
+
# Hoe.plugin :perforce
|
19
|
+
# Hoe.plugin :racc
|
20
|
+
# Hoe.plugin :rubyforge
|
21
|
+
# Hoe.plugin :seattlerb
|
22
|
+
|
23
|
+
Hoe.spec "minitest-debugger" do
|
24
|
+
developer "Ryan Davis", "ryand-ruby@zenspider.com"
|
25
|
+
|
26
|
+
self.rubyforge_name = "seattlerb"
|
27
|
+
end
|
28
|
+
|
29
|
+
# vim: syntax=ruby
|
data/example.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# require 'minitest/debugger'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
5
|
+
def good
|
6
|
+
42
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_assert
|
10
|
+
assert_equal 42, good
|
11
|
+
end
|
12
|
+
|
13
|
+
def wrong
|
14
|
+
24
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_assert_failure
|
18
|
+
assert_equal 42, wrong
|
19
|
+
end
|
20
|
+
|
21
|
+
def bad
|
22
|
+
raise "no"
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_assert_error
|
26
|
+
assert_equal 42, bad
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
alias set_trace_funk set_trace_func
|
2
|
+
|
3
|
+
def set_trace_func(*args)
|
4
|
+
# DEBUGGER__::Context.send :attr_writer, :stop_next
|
5
|
+
DEBUGGER__::Context.send :attr_writer, :finish_pos
|
6
|
+
DEBUGGER__.context.finish_pos = -1
|
7
|
+
DEBUGGER__.context.stop_next -1
|
8
|
+
set_trace_funk(*args)
|
9
|
+
end
|
10
|
+
|
11
|
+
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
|
12
|
+
|
13
|
+
# this is unbelievably stupid.
|
14
|
+
path = caller.reject { |s| s =~ /custom_require/ }.first
|
15
|
+
if path then
|
16
|
+
path = path[/^[^:]+/]
|
17
|
+
SCRIPT_LINES__[path] = File.readlines(path)
|
18
|
+
end
|
19
|
+
SCRIPT_LINES__[__FILE__] = File.readlines(__FILE__)
|
20
|
+
|
21
|
+
require 'debug'
|
22
|
+
require "minitest/unit"
|
23
|
+
|
24
|
+
##
|
25
|
+
# This is a stupid simple example of how easy it is to make a minitest
|
26
|
+
# plugin that does something useful. In this case it wraps assert so
|
27
|
+
# that failed assertions will drop into the ruby debugger.
|
28
|
+
|
29
|
+
module MiniTest::Debugger
|
30
|
+
VERSION = '1.0.0'
|
31
|
+
|
32
|
+
def assert test, msg = nil
|
33
|
+
begin
|
34
|
+
super
|
35
|
+
rescue MiniTest::Assertion => e
|
36
|
+
warn "Assertion Failed. Dropping into debugger now:"
|
37
|
+
DEBUGGER__.interrupt
|
38
|
+
raise e
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class MiniTest::Unit::TestCase
|
44
|
+
include MiniTest::Debugger
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-debugger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Davis
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
20
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
21
|
+
GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
|
22
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
23
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
24
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
25
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
26
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
27
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
28
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
29
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
30
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
31
|
+
AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
|
32
|
+
vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
|
33
|
+
w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
|
34
|
+
l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
35
|
+
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
36
|
+
FBHgymkyj/AOSqKRIpXPhjC6
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
|
39
|
+
date: 2011-11-08 00:00:00 Z
|
40
|
+
dependencies:
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
prerelease: false
|
44
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 21
|
50
|
+
segments:
|
51
|
+
- 3
|
52
|
+
- 9
|
53
|
+
version: "3.9"
|
54
|
+
type: :development
|
55
|
+
version_requirements: *id001
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: minitest
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ~>
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 13
|
65
|
+
segments:
|
66
|
+
- 2
|
67
|
+
- 7
|
68
|
+
version: "2.7"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id002
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: hoe
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 27
|
80
|
+
segments:
|
81
|
+
- 2
|
82
|
+
- 12
|
83
|
+
version: "2.12"
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id003
|
86
|
+
description: |-
|
87
|
+
This is a stupid simple example of how easy it is to make a minitest
|
88
|
+
plugin that does something useful. In this case it wraps assert so
|
89
|
+
that failed assertions will drop into the ruby debugger.
|
90
|
+
email:
|
91
|
+
- ryand-ruby@zenspider.com
|
92
|
+
executables: []
|
93
|
+
|
94
|
+
extensions: []
|
95
|
+
|
96
|
+
extra_rdoc_files:
|
97
|
+
- History.txt
|
98
|
+
- Manifest.txt
|
99
|
+
- README.txt
|
100
|
+
files:
|
101
|
+
- .autotest
|
102
|
+
- History.txt
|
103
|
+
- Manifest.txt
|
104
|
+
- README.txt
|
105
|
+
- Rakefile
|
106
|
+
- example.rb
|
107
|
+
- lib/minitest/debugger.rb
|
108
|
+
homepage: https://github.com/seattlerb/minitest-debugger
|
109
|
+
licenses: []
|
110
|
+
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options:
|
113
|
+
- --main
|
114
|
+
- README.txt
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
124
|
+
- 0
|
125
|
+
version: "0"
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
hash: 3
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
version: "0"
|
135
|
+
requirements: []
|
136
|
+
|
137
|
+
rubyforge_project: seattlerb
|
138
|
+
rubygems_version: 1.8.10
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: This is a stupid simple example of how easy it is to make a minitest plugin that does something useful
|
142
|
+
test_files: []
|
143
|
+
|
metadata.gz.sig
ADDED
Binary file
|