structured_warnings 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +200 -0
- data/lib/{structured_warnings/dynamic.rb → dynamic.rb} +0 -0
- data/lib/structured_warnings.rb +19 -9
- data/lib/structured_warnings/base.rb +132 -0
- data/lib/structured_warnings/kernel.rb +5 -65
- data/lib/structured_warnings/minitest.rb +5 -0
- data/lib/structured_warnings/test.rb +3 -5
- data/lib/structured_warnings/test/assertions.rb +93 -98
- data/lib/structured_warnings/test/warner.rb +32 -35
- data/lib/structured_warnings/test_unit.rb +5 -0
- data/lib/structured_warnings/version.rb +3 -0
- data/lib/structured_warnings/warner.rb +13 -11
- data/lib/structured_warnings/warning.rb +61 -119
- data/lib/warning.rb +9 -0
- metadata +53 -92
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -21
- data/History.txt +0 -36
- data/License.txt +0 -20
- data/README.rdoc +0 -137
- data/Rakefile +0 -55
- data/doc/DeprecatedMethodWarning.html +0 -105
- data/doc/DeprecatedSignatureWarning.html +0 -106
- data/doc/DeprecationWarning.html +0 -106
- data/doc/Dynamic.html +0 -125
- data/doc/Object.html +0 -117
- data/doc/README_rdoc.html +0 -283
- data/doc/StandardWarning.html +0 -104
- data/doc/StructuredWarnings.html +0 -125
- data/doc/StructuredWarnings/ClassMethods.html +0 -192
- data/doc/StructuredWarnings/Kernel.html +0 -222
- data/doc/StructuredWarnings/Test.html +0 -97
- data/doc/StructuredWarnings/Test/Assertions.html +0 -272
- data/doc/StructuredWarnings/Test/Warner.html +0 -208
- data/doc/StructuredWarnings/Warner.html +0 -162
- data/doc/Test.html +0 -95
- data/doc/Test/Unit.html +0 -95
- data/doc/Warning.html +0 -398
- data/doc/Warning/ClassMethods.html +0 -278
- data/doc/created.rid +0 -10
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -590
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -121
- data/doc/js/darkfish.js +0 -161
- data/doc/js/jquery.js +0 -4
- data/doc/js/navigation.js +0 -142
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -109
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -228
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -200
- data/structured_warnings.gemspec +0 -24
- data/test/structured_warnings_test.rb +0 -187
@@ -1,272 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>module StructuredWarnings::Test::Assertions - structured_warnings</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../../";
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script src="../../js/jquery.js"></script>
|
14
|
-
<script src="../../js/darkfish.js"></script>
|
15
|
-
|
16
|
-
<link href="../../css/fonts.css" rel="stylesheet">
|
17
|
-
<link href="../../css/rdoc.css" rel="stylesheet">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<body id="top" role="document" class="module">
|
22
|
-
<nav role="navigation">
|
23
|
-
<div id="project-navigation">
|
24
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
-
<h2>
|
26
|
-
<a href="../../index.html" rel="home">Home</a>
|
27
|
-
</h2>
|
28
|
-
|
29
|
-
<div id="table-of-contents-navigation">
|
30
|
-
<a href="../../table_of_contents.html#pages">Pages</a>
|
31
|
-
<a href="../../table_of_contents.html#classes">Classes</a>
|
32
|
-
<a href="../../table_of_contents.html#methods">Methods</a>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
-
<form action="#" method="get" accept-charset="utf-8">
|
38
|
-
<div id="search-field-wrapper">
|
39
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
-
aria-autocomplete="list" aria-controls="search-results"
|
41
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<ul id="search-results" aria-label="Search Results"
|
46
|
-
aria-busy="false" aria-expanded="false"
|
47
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
-
</form>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<div id="class-metadata">
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<!-- Method Quickref -->
|
61
|
-
<div id="method-list-section" class="nav-section">
|
62
|
-
<h3>Methods</h3>
|
63
|
-
|
64
|
-
<ul class="link-list" role="directory">
|
65
|
-
|
66
|
-
<li ><a href="#method-i-assert_no_warn">#assert_no_warn</a>
|
67
|
-
|
68
|
-
<li ><a href="#method-i-assert_warn">#assert_warn</a>
|
69
|
-
|
70
|
-
</ul>
|
71
|
-
</div>
|
72
|
-
|
73
|
-
</div>
|
74
|
-
</nav>
|
75
|
-
|
76
|
-
<main role="main" aria-labelledby="module-StructuredWarnings::Test::Assertions">
|
77
|
-
<h1 id="module-StructuredWarnings::Test::Assertions" class="module">
|
78
|
-
module StructuredWarnings::Test::Assertions
|
79
|
-
</h1>
|
80
|
-
|
81
|
-
<section class="description">
|
82
|
-
|
83
|
-
</section>
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
99
|
-
<header>
|
100
|
-
<h3>Public Instance Methods</h3>
|
101
|
-
</header>
|
102
|
-
|
103
|
-
|
104
|
-
<div id="method-i-assert_no_warn" class="method-detail ">
|
105
|
-
|
106
|
-
|
107
|
-
<div class="method-heading">
|
108
|
-
<span class="method-callseq">
|
109
|
-
assert_no_warn(message = nil) {|| ...}
|
110
|
-
</span>
|
111
|
-
|
112
|
-
<span class="method-click-advice">click to toggle source</span>
|
113
|
-
|
114
|
-
</div>
|
115
|
-
|
116
|
-
<div class="method-heading">
|
117
|
-
<span class="method-callseq">
|
118
|
-
assert_no_warn(warning_class, message) {|| ...}
|
119
|
-
</span>
|
120
|
-
|
121
|
-
</div>
|
122
|
-
|
123
|
-
<div class="method-heading">
|
124
|
-
<span class="method-callseq">
|
125
|
-
assert_no_warn(warning_instance) {|| ...}
|
126
|
-
</span>
|
127
|
-
|
128
|
-
</div>
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
<div class="method-description">
|
133
|
-
|
134
|
-
<p>Asserts that the given warning was not emmitted. It may be restricted to a
|
135
|
-
certain subtree of warnings and/or message.</p>
|
136
|
-
|
137
|
-
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">foo</span>
|
138
|
-
<span class="ruby-identifier">warn</span> <span class="ruby-constant">DeprecatedMethodWarning</span>, <span class="ruby-string">"used foo, use bar instead"</span>
|
139
|
-
<span class="ruby-identifier">bar</span>
|
140
|
-
<span class="ruby-keyword">end</span>
|
141
|
-
|
142
|
-
<span class="ruby-identifier">assert_no_warn</span>(<span class="ruby-constant">StandardWarning</span>) { <span class="ruby-identifier">foo</span> } <span class="ruby-comment"># passes</span>
|
143
|
-
|
144
|
-
<span class="ruby-identifier">assert_no_warn</span>(<span class="ruby-constant">DeprecationWarning</span>) { <span class="ruby-identifier">foo</span> } <span class="ruby-comment"># fails</span>
|
145
|
-
<span class="ruby-identifier">assert_no_warn</span>() { <span class="ruby-identifier">foo</span> } <span class="ruby-comment"># fails</span>
|
146
|
-
</pre>
|
147
|
-
|
148
|
-
<p>See <a href="Assertions.html#method-i-assert_warn">#assert_warn</a> for
|
149
|
-
more examples.</p>
|
150
|
-
|
151
|
-
<p><strong>Note</strong>: It is currently not possible to add a custom failure
|
152
|
-
message.</p>
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
<div class="method-source-code" id="assert_no_warn-source">
|
158
|
-
<pre><span class="ruby-comment"># File lib/structured_warnings/test/assertions.rb, line 26</span>
|
159
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">assert_no_warn</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
160
|
-
<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span> = <span class="ruby-identifier">parse_arguments</span>(<span class="ruby-identifier">args</span>)
|
161
|
-
|
162
|
-
<span class="ruby-identifier">w</span> = <span class="ruby-constant">StructuredWarnings</span><span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Warner</span>.<span class="ruby-identifier">new</span>
|
163
|
-
<span class="ruby-constant">StructuredWarnings</span><span class="ruby-operator">::</span><span class="ruby-identifier">with_warner</span>(<span class="ruby-identifier">w</span>) <span class="ruby-keyword">do</span>
|
164
|
-
<span class="ruby-keyword">yield</span>
|
165
|
-
<span class="ruby-keyword">end</span>
|
166
|
-
<span class="ruby-identifier">assert_block</span>(<span class="ruby-node">"<#{args_inspect(args)}> has been emitted."</span>) <span class="ruby-keyword">do</span>
|
167
|
-
<span class="ruby-operator">!</span><span class="ruby-identifier">w</span>.<span class="ruby-identifier">warned?</span>(<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span>)
|
168
|
-
<span class="ruby-keyword">end</span>
|
169
|
-
<span class="ruby-keyword">end</span></pre>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
</div>
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
</div>
|
178
|
-
|
179
|
-
|
180
|
-
<div id="method-i-assert_warn" class="method-detail ">
|
181
|
-
|
182
|
-
|
183
|
-
<div class="method-heading">
|
184
|
-
<span class="method-callseq">
|
185
|
-
assert_warn(message = nil) {|| ...}
|
186
|
-
</span>
|
187
|
-
|
188
|
-
<span class="method-click-advice">click to toggle source</span>
|
189
|
-
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div class="method-heading">
|
193
|
-
<span class="method-callseq">
|
194
|
-
assert_warn(warning_class, message) {|| ...}
|
195
|
-
</span>
|
196
|
-
|
197
|
-
</div>
|
198
|
-
|
199
|
-
<div class="method-heading">
|
200
|
-
<span class="method-callseq">
|
201
|
-
assert_warn(warning_instance) {|| ...}
|
202
|
-
</span>
|
203
|
-
|
204
|
-
</div>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
<div class="method-description">
|
209
|
-
|
210
|
-
<p>Asserts that the given warning was emmitted. It may be restricted to a
|
211
|
-
certain subtree of warnings and/or message.</p>
|
212
|
-
|
213
|
-
<pre class="ruby"><span class="ruby-keyword">def</span> <span class="ruby-identifier">foo</span>
|
214
|
-
<span class="ruby-identifier">warn</span> <span class="ruby-constant">DeprecatedMethodWarning</span>, <span class="ruby-string">"used foo, use bar instead"</span>
|
215
|
-
<span class="ruby-identifier">bar</span>
|
216
|
-
<span class="ruby-keyword">end</span>
|
217
|
-
|
218
|
-
<span class="ruby-comment"># passes</span>
|
219
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">DeprecatedMethodWarning</span>) { <span class="ruby-identifier">foo</span> }
|
220
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">DeprecationWarning</span>) { <span class="ruby-identifier">foo</span> }
|
221
|
-
<span class="ruby-identifier">assert_warn</span>() { <span class="ruby-identifier">foo</span> }
|
222
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">Warning</span>, <span class="ruby-string">"used foo, use bar instead"</span>) { <span class="ruby-identifier">foo</span> }
|
223
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">Warning</span>, <span class="ruby-regexp">/use bar/</span>) { <span class="ruby-identifier">foo</span> }
|
224
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">Warning</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"used foo, use bar instead"</span>)) { <span class="ruby-identifier">foo</span> }
|
225
|
-
|
226
|
-
<span class="ruby-comment"># fails</span>
|
227
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">StandardWarning</span>) { <span class="ruby-identifier">foo</span> }
|
228
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">Warning</span>, <span class="ruby-regexp">/deprecated/</span>) { <span class="ruby-identifier">foo</span> }
|
229
|
-
<span class="ruby-identifier">assert_warn</span>(<span class="ruby-constant">Warning</span>.<span class="ruby-identifier">new</span>) { <span class="ruby-identifier">foo</span> }
|
230
|
-
</pre>
|
231
|
-
|
232
|
-
<p><strong>Note</strong>: It is currently not possible to add a custom failure
|
233
|
-
message.</p>
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
<div class="method-source-code" id="assert_warn-source">
|
239
|
-
<pre><span class="ruby-comment"># File lib/structured_warnings/test/assertions.rb, line 65</span>
|
240
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">assert_warn</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
241
|
-
<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span> = <span class="ruby-identifier">parse_arguments</span>(<span class="ruby-identifier">args</span>)
|
242
|
-
|
243
|
-
<span class="ruby-identifier">w</span> = <span class="ruby-constant">StructuredWarnings</span><span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Warner</span>.<span class="ruby-identifier">new</span>
|
244
|
-
<span class="ruby-constant">StructuredWarnings</span><span class="ruby-operator">::</span><span class="ruby-identifier">with_warner</span>(<span class="ruby-identifier">w</span>) <span class="ruby-keyword">do</span>
|
245
|
-
<span class="ruby-keyword">yield</span>
|
246
|
-
<span class="ruby-keyword">end</span>
|
247
|
-
<span class="ruby-identifier">assert_block</span>(<span class="ruby-node">"<#{args_inspect(args)}> has not been emitted."</span>) <span class="ruby-keyword">do</span>
|
248
|
-
<span class="ruby-identifier">w</span>.<span class="ruby-identifier">warned?</span>(<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span>)
|
249
|
-
<span class="ruby-keyword">end</span>
|
250
|
-
<span class="ruby-keyword">end</span></pre>
|
251
|
-
</div>
|
252
|
-
|
253
|
-
</div>
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
</div>
|
259
|
-
|
260
|
-
|
261
|
-
</section>
|
262
|
-
|
263
|
-
</section>
|
264
|
-
</main>
|
265
|
-
|
266
|
-
|
267
|
-
<footer id="validator-badges" role="contentinfo">
|
268
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
269
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
270
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
271
|
-
</footer>
|
272
|
-
|
@@ -1,208 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class StructuredWarnings::Test::Warner - structured_warnings</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../../";
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script src="../../js/jquery.js"></script>
|
14
|
-
<script src="../../js/darkfish.js"></script>
|
15
|
-
|
16
|
-
<link href="../../css/fonts.css" rel="stylesheet">
|
17
|
-
<link href="../../css/rdoc.css" rel="stylesheet">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<body id="top" role="document" class="class">
|
22
|
-
<nav role="navigation">
|
23
|
-
<div id="project-navigation">
|
24
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
-
<h2>
|
26
|
-
<a href="../../index.html" rel="home">Home</a>
|
27
|
-
</h2>
|
28
|
-
|
29
|
-
<div id="table-of-contents-navigation">
|
30
|
-
<a href="../../table_of_contents.html#pages">Pages</a>
|
31
|
-
<a href="../../table_of_contents.html#classes">Classes</a>
|
32
|
-
<a href="../../table_of_contents.html#methods">Methods</a>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
-
<form action="#" method="get" accept-charset="utf-8">
|
38
|
-
<div id="search-field-wrapper">
|
39
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
-
aria-autocomplete="list" aria-controls="search-results"
|
41
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<ul id="search-results" aria-label="Search Results"
|
46
|
-
aria-busy="false" aria-expanded="false"
|
47
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
-
</form>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<div id="class-metadata">
|
56
|
-
|
57
|
-
<div id="parent-class-section" class="nav-section">
|
58
|
-
<h3>Parent</h3>
|
59
|
-
|
60
|
-
|
61
|
-
<p class="link"><a href="../Warner.html">StructuredWarnings::Warner</a>
|
62
|
-
|
63
|
-
</div>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<div id="method-list-section" class="nav-section">
|
69
|
-
<h3>Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list" role="directory">
|
72
|
-
|
73
|
-
<li ><a href="#method-i-format">#format</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-warned-3F">#warned?</a>
|
76
|
-
|
77
|
-
</ul>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
</div>
|
81
|
-
</nav>
|
82
|
-
|
83
|
-
<main role="main" aria-labelledby="class-StructuredWarnings::Test::Warner">
|
84
|
-
<h1 id="class-StructuredWarnings::Test::Warner" class="class">
|
85
|
-
class StructuredWarnings::Test::Warner
|
86
|
-
</h1>
|
87
|
-
|
88
|
-
<section class="description">
|
89
|
-
|
90
|
-
<p>This warner is used in <a
|
91
|
-
href="Assertions.html#method-i-assert_warn">StructuredWarnings::Test::Assertions#assert_warn</a>
|
92
|
-
and <a
|
93
|
-
href="Assertions.html#method-i-assert_no_warn">StructuredWarnings::Test::Assertions#assert_no_warn</a>
|
94
|
-
blocks. It captures all warnings in format and provides access to them
|
95
|
-
using the warned? method.</p>
|
96
|
-
|
97
|
-
</section>
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
113
|
-
<header>
|
114
|
-
<h3>Public Instance Methods</h3>
|
115
|
-
</header>
|
116
|
-
|
117
|
-
|
118
|
-
<div id="method-i-format" class="method-detail ">
|
119
|
-
|
120
|
-
<div class="method-heading">
|
121
|
-
<span class="method-name">format</span><span
|
122
|
-
class="method-args">(warning, message, call_stack)</span>
|
123
|
-
|
124
|
-
<span class="method-click-advice">click to toggle source</span>
|
125
|
-
|
126
|
-
</div>
|
127
|
-
|
128
|
-
|
129
|
-
<div class="method-description">
|
130
|
-
|
131
|
-
<p>Overrides the public interface of <a
|
132
|
-
href="../Warner.html">StructuredWarnings::Warner</a>. This method always
|
133
|
-
returns nil to avoid warnings on stdout during assert_warn and
|
134
|
-
assert_no_warn blocks.</p>
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<div class="method-source-code" id="format-source">
|
140
|
-
<pre><span class="ruby-comment"># File lib/structured_warnings/test/warner.rb, line 10</span>
|
141
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">format</span>(<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">call_stack</span>)
|
142
|
-
<span class="ruby-identifier">given_warnings</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">warning</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>)
|
143
|
-
<span class="ruby-keyword">nil</span>
|
144
|
-
<span class="ruby-keyword">end</span></pre>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
</div>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
</div>
|
153
|
-
|
154
|
-
|
155
|
-
<div id="method-i-warned-3F" class="method-detail ">
|
156
|
-
|
157
|
-
<div class="method-heading">
|
158
|
-
<span class="method-name">warned?</span><span
|
159
|
-
class="method-args">(warning, message = nil)</span>
|
160
|
-
|
161
|
-
<span class="method-click-advice">click to toggle source</span>
|
162
|
-
|
163
|
-
</div>
|
164
|
-
|
165
|
-
|
166
|
-
<div class="method-description">
|
167
|
-
|
168
|
-
<p>Returns true if any warning or a subclass of warning was emitted.</p>
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
<div class="method-source-code" id="warned-3F-source">
|
174
|
-
<pre><span class="ruby-comment"># File lib/structured_warnings/test/warner.rb, line 16</span>
|
175
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">warned?</span>(<span class="ruby-identifier">warning</span>, <span class="ruby-identifier">message</span> = <span class="ruby-keyword">nil</span>)
|
176
|
-
<span class="ruby-keyword">case</span> <span class="ruby-identifier">message</span>
|
177
|
-
<span class="ruby-keyword">when</span> <span class="ruby-constant">Regexp</span>
|
178
|
-
<span class="ruby-identifier">given_warnings</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">warning</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">message</span>}
|
179
|
-
<span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>
|
180
|
-
<span class="ruby-identifier">given_warnings</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">warning</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">message</span>}
|
181
|
-
<span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>
|
182
|
-
<span class="ruby-identifier">given_warnings</span>.<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-identifier">warning</span>)}
|
183
|
-
<span class="ruby-keyword">else</span>
|
184
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-string">"Unkown argument for 'message'"</span>
|
185
|
-
<span class="ruby-keyword">end</span>
|
186
|
-
<span class="ruby-keyword">end</span></pre>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
</div>
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
</div>
|
195
|
-
|
196
|
-
|
197
|
-
</section>
|
198
|
-
|
199
|
-
</section>
|
200
|
-
</main>
|
201
|
-
|
202
|
-
|
203
|
-
<footer id="validator-badges" role="contentinfo">
|
204
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
205
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
206
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
207
|
-
</footer>
|
208
|
-
|