coverage/index.html in regexp-examples-0.3.2 vs coverage/index.html in regexp-examples-0.4.0

- old
+ new

@@ -12,30 +12,30 @@ <body> <div id="loading"> <img src="./assets/0.8.0/loading.gif" alt="loading"/> </div> <div id="wrapper" style="display:none;"> - <div class="timestamp">Generated <abbr class="timeago" title="2015-01-24T16:02:51+00:00">2015-01-24T16:02:51+00:00</abbr></div> + <div class="timestamp">Generated <abbr class="timeago" title="2015-01-25T11:29:58+00:00">2015-01-25T11:29:58+00:00</abbr></div> <ul class="group_tabs"></ul> <div id="content"> <div class="file_list_container" id="AllFiles"> <h2> <span class="group_name">All Files</span> (<span class="covered_percent"><span class="green">100.0%</span></span> covered at <span class="covered_strength"> <span class="green"> - 83.39 + 80.6 </span> </span> hits/line) </h2> <a name="AllFiles"></a> <div> <b>10</b> files in total. - <b>365</b> relevant lines. - <span class="green"><b>365</b> lines covered</span> and + <b>389</b> relevant lines. + <span class="green"><b>389</b> lines covered</span> and <span class="red"><b>0</b> lines missed </span> </div> <table class="file_list"> <thead> <tr> @@ -61,95 +61,95 @@ </tr> <tr> <td class="strong"><a href="#93190cc93d103d3260faf0664b10ff54c6eea083" class="src_link" title="lib/regexp-examples/backreferences.rb">lib/regexp-examples/backreferences.rb</a></td> <td class="green strong">100.0 %</td> - <td>21</td> - <td>11</td> - <td>11</td> + <td>27</td> + <td>13</td> + <td>13</td> <td>0</td> - <td>53.8</td> + <td>68.4</td> </tr> <tr> <td class="strong"><a href="#63a4d8bce3d583c95db1448751ea1a5d89880a5c" class="src_link" title="lib/regexp-examples/constants.rb">lib/regexp-examples/constants.rb</a></td> <td class="green strong">100.0 %</td> - <td>47</td> - <td>13</td> - <td>13</td> + <td>64</td> + <td>23</td> + <td>23</td> <td>0</td> - <td>6.2</td> + <td>30.2</td> </tr> <tr> <td class="strong"><a href="#1bb4101b0e3c014469af0221a5549cd762b969cb" class="src_link" title="lib/regexp-examples/exceptions.rb">lib/regexp-examples/exceptions.rb</a></td> <td class="green strong">100.0 %</td> + <td>6</td> <td>5</td> - <td>4</td> - <td>4</td> + <td>5</td> <td>0</td> <td>1.0</td> </tr> <tr> <td class="strong"><a href="#a6c87537a3f20f2e6e7fc1c61e4c6c791987b6f8" class="src_link" title="lib/regexp-examples/groups.rb">lib/regexp-examples/groups.rb</a></td> <td class="green strong">100.0 %</td> - <td>160</td> - <td>84</td> - <td>84</td> + <td>153</td> + <td>82</td> + <td>82</td> <td>0</td> - <td>173.7</td> + <td>156.0</td> </tr> <tr> <td class="strong"><a href="#9ae955cbc95623603c71e3cb5269e0b5572d66bb" class="src_link" title="lib/regexp-examples/helpers.rb">lib/regexp-examples/helpers.rb</a></td> <td class="green strong">100.0 %</td> <td>34</td> <td>14</td> <td>14</td> <td>0</td> - <td>179.8</td> + <td>267.1</td> </tr> <tr> <td class="strong"><a href="#d0056bbc5aec01e743374a8696b2086c03bae8f0" class="src_link" title="lib/regexp-examples/parser.rb">lib/regexp-examples/parser.rb</a></td> <td class="green strong">100.0 %</td> - <td>244</td> - <td>136</td> - <td>136</td> + <td>248</td> + <td>137</td> + <td>137</td> <td>0</td> - <td>61.3</td> + <td>64.4</td> </tr> <tr> <td class="strong"><a href="#7f62a530f44ef896b613d357fee92d31ffb7ede8" class="src_link" title="lib/regexp-examples/regexp_extensions.rb">lib/regexp-examples/regexp_extensions.rb</a></td> <td class="green strong">100.0 %</td> - <td>18</td> + <td>12</td> <td>6</td> <td>6</td> <td>0</td> - <td>33.2</td> + <td>35.2</td> </tr> <tr> <td class="strong"><a href="#0688fc9c3b085e9a6444775c61767c9c5742fb69" class="src_link" title="lib/regexp-examples/repeaters.rb">lib/regexp-examples/repeaters.rb</a></td> <td class="green strong">100.0 %</td> - <td>84</td> - <td>46</td> - <td>46</td> + <td>88</td> + <td>47</td> + <td>47</td> <td>0</td> - <td>75.8</td> + <td>75.6</td> </tr> <tr> <td class="strong"><a href="#953f94f8f5f8bad7e1fa800f942a74b781f8fa1c" class="src_link" title="spec/regexp-examples_spec.rb">spec/regexp-examples_spec.rb</a></td> <td class="green strong">100.0 %</td> - <td>225</td> - <td>50</td> - <td>50</td> + <td>245</td> + <td>61</td> + <td>61</td> <td>0</td> - <td>12.4</td> + <td>10.4</td> </tr> </tbody> </table> </div> @@ -199,12 +199,12 @@ <div class="source_table" id="93190cc93d103d3260faf0664b10ff54c6eea083"> <div class="header"> <h3>lib/regexp-examples/backreferences.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>11</b> relevant lines. - <span class="green"><b>11</b> lines covered</span> and + <b>13</b> relevant lines. + <span class="green"><b>13</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -226,113 +226,149 @@ <span class="hits">1</span> <code class="ruby"> def substitute_backreferences(full_examples)</code> </li> - <li class="covered" data-hits="89" data-linenumber="4"> - <span class="hits">89</span> + <li class="never" data-hits="" data-linenumber="4"> + <code class="ruby"> full_examples.map do |full_example|</code> </li> - <li class="covered" data-hits="183" data-linenumber="5"> - <span class="hits">183</span> + <li class="covered" data-hits="215" data-linenumber="5"> + <span class="hits">215</span> - <code class="ruby"> while full_example.match(/__(\w+?)__/)</code> + <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="28" data-linenumber="6"> - <span class="hits">28</span> + <li class="covered" data-hits="215" data-linenumber="6"> + <span class="hits">215</span> - <code class="ruby"> full_example.sub!(/__(\w+?)__/, find_backref_for(full_example, $1))</code> + <code class="ruby"> while full_example.match(/__(\w+?)__/)</code> </li> - <li class="never" data-hits="" data-linenumber="7"> + <li class="covered" data-hits="32" data-linenumber="7"> + <span class="hits">32</span> + <code class="ruby"> full_example.sub!(/__(\w+?)__/, find_backref_for(full_example, $1))</code> + </li> + + <li class="never" data-hits="" data-linenumber="8"> - <code class="ruby"> end</code> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="183" data-linenumber="8"> - <span class="hits">183</span> + <li class="covered" data-hits="213" data-linenumber="9"> + <span class="hits">213</span> - <code class="ruby"> full_example</code> + <code class="ruby"> full_example</code> </li> - <li class="never" data-hits="" data-linenumber="9"> + <li class="never" data-hits="" data-linenumber="10"> - <code class="ruby"> end</code> + <code class="ruby"> rescue RegexpExamples::BackrefNotFound</code> </li> - <li class="never" data-hits="" data-linenumber="10"> + <li class="never" data-hits="" data-linenumber="11"> + <code class="ruby"> # For instance, one &quot;full example&quot; from /(a|(b)) \2/: &quot;a __2__&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="12"> + + + <code class="ruby"> # should be rejected because the backref (\2) does not exist</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="13"> + <span class="hits">2</span> + + <code class="ruby"> nil</code> + </li> + + <li class="never" data-hits="" data-linenumber="14"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="95" data-linenumber="15"> + <span class="hits">95</span> + + <code class="ruby"> end.compact</code> + </li> + + <li class="never" data-hits="" data-linenumber="16"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="11"> + <li class="never" data-hits="" data-linenumber="17"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="12"> + <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> <code class="ruby"> private</code> </li> - <li class="covered" data-hits="1" data-linenumber="13"> + <li class="covered" data-hits="1" data-linenumber="19"> <span class="hits">1</span> <code class="ruby"> def find_backref_for(full_example, group_id)</code> </li> - <li class="covered" data-hits="28" data-linenumber="14"> - <span class="hits">28</span> + <li class="never" data-hits="" data-linenumber="20"> + <code class="ruby"> full_example.all_subgroups.detect do |subgroup|</code> </li> - <li class="covered" data-hits="76" data-linenumber="15"> - <span class="hits">76</span> + <li class="covered" data-hits="80" data-linenumber="21"> + <span class="hits">80</span> <code class="ruby"> subgroup.group_id == group_id</code> </li> - <li class="never" data-hits="" data-linenumber="16"> + <li class="covered" data-hits="32" data-linenumber="22"> + <span class="hits">32</span> - - <code class="ruby"> end</code> + <code class="ruby"> end || raise(RegexpExamples::BackrefNotFound)</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="23"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="18"> + <li class="never" data-hits="" data-linenumber="24"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="19"> + <li class="never" data-hits="" data-linenumber="25"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="20"> + <li class="never" data-hits="" data-linenumber="26"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="21"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby">end</code> </li> @@ -343,12 +379,12 @@ <div class="source_table" id="63a4d8bce3d583c95db1448751ea1a5d89880a5c"> <div class="header"> <h3>lib/regexp-examples/constants.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>13</b> relevant lines. - <span class="green"><b>13</b> lines covered</span> and + <b>23</b> relevant lines. + <span class="green"><b>23</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -358,281 +394,383 @@ <span class="hits">1</span> <code class="ruby">module RegexpExamples</code> </li> - <li class="never" data-hits="" data-linenumber="2"> + <li class="covered" data-hits="1" data-linenumber="2"> + <span class="hits">1</span> - - <code class="ruby"> # The maximum variance for any given repeater, to prevent a huge/infinite number of</code> + <code class="ruby"> class ResultCountLimiters</code> </li> <li class="never" data-hits="" data-linenumber="3"> - <code class="ruby"> # examples from being listed. For example, if MaxRepeaterVariance = 2 then:</code> + <code class="ruby"> # The maximum variance for any given repeater, to prevent a huge/infinite number of</code> </li> <li class="never" data-hits="" data-linenumber="4"> - <code class="ruby"> # .* is equivalent to .{0,2}</code> + <code class="ruby"> # examples from being listed. For example, if @@max_repeater_variance = 2 then:</code> </li> <li class="never" data-hits="" data-linenumber="5"> - <code class="ruby"> # .+ is equivalent to .{1,3}</code> + <code class="ruby"> # .* is equivalent to .{0,2}</code> </li> <li class="never" data-hits="" data-linenumber="6"> - <code class="ruby"> # .{2,} is equivalent to .{2,4}</code> + <code class="ruby"> # .+ is equivalent to .{1,3}</code> </li> <li class="never" data-hits="" data-linenumber="7"> - <code class="ruby"> # .{,3} is equivalent to .{0,2}</code> + <code class="ruby"> # .{2,} is equivalent to .{2,4}</code> </li> <li class="never" data-hits="" data-linenumber="8"> - <code class="ruby"> # .{3,8} is equivalent to .{3,5}</code> + <code class="ruby"> # .{,3} is equivalent to .{0,2}</code> </li> - <li class="covered" data-hits="1" data-linenumber="9"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="9"> - <code class="ruby"> MaxRepeaterVariance = 2</code> + + <code class="ruby"> # .{3,8} is equivalent to .{3,5}</code> </li> - <li class="never" data-hits="" data-linenumber="10"> + <li class="covered" data-hits="1" data-linenumber="10"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> MaxRepeaterVarianceDefault = 2</code> </li> <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> # Maximum number of characters returned from a char set, to reduce output spam</code> + <code class="ruby"></code> </li> <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> # For example:</code> + <code class="ruby"> # Maximum number of characters returned from a char set, to reduce output spam</code> </li> <li class="never" data-hits="" data-linenumber="13"> - <code class="ruby"> # If MaxGroupResults = 5, then</code> + <code class="ruby"> # For example, if @@max_group_results = 5 then:</code> </li> <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> # \d = [0, 1, 2, 3, 4]</code> + <code class="ruby"> # \d = [&quot;0&quot;, &quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;]</code> </li> - <li class="covered" data-hits="1" data-linenumber="15"> + <li class="never" data-hits="" data-linenumber="15"> + + + <code class="ruby"> # \w = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;]</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> - <code class="ruby"> MaxGroupResults = 5</code> + <code class="ruby"> MaxGroupResultsDefault = 5</code> </li> - <li class="never" data-hits="" data-linenumber="16"> + <li class="never" data-hits="" data-linenumber="17"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="17"> + <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> + <code class="ruby"> class &lt;&lt; self</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="19"> + <span class="hits">1</span> + + <code class="ruby"> attr_reader :max_repeater_variance, :max_group_results</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="20"> + <span class="hits">1</span> + + <code class="ruby"> def configure!(max_repeater_variance, max_group_results)</code> + </li> + + <li class="covered" data-hits="112" data-linenumber="21"> + <span class="hits">112</span> + + <code class="ruby"> @max_repeater_variance = (max_repeater_variance || MaxRepeaterVarianceDefault)</code> + </li> + + <li class="covered" data-hits="112" data-linenumber="22"> + <span class="hits">112</span> + + <code class="ruby"> @max_group_results = (max_group_results || MaxGroupResultsDefault)</code> + </li> + + <li class="never" data-hits="" data-linenumber="23"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="25"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="26"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="27"> + <span class="hits">1</span> + + <code class="ruby"> def self.MaxRepeaterVariance</code> + </li> + + <li class="covered" data-hits="16" data-linenumber="28"> + <span class="hits">16</span> + + <code class="ruby"> ResultCountLimiters.max_repeater_variance</code> + </li> + + <li class="never" data-hits="" data-linenumber="29"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="30"> + <span class="hits">1</span> + + <code class="ruby"> def self.MaxGroupResults</code> + </li> + + <li class="covered" data-hits="369" data-linenumber="31"> + <span class="hits">369</span> + + <code class="ruby"> ResultCountLimiters.max_group_results</code> + </li> + + <li class="never" data-hits="" data-linenumber="32"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="33"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="34"> + <span class="hits">1</span> + <code class="ruby"> module CharSets</code> </li> - <li class="covered" data-hits="1" data-linenumber="18"> + <li class="covered" data-hits="1" data-linenumber="35"> <span class="hits">1</span> <code class="ruby"> Lower = Array(&#39;a&#39;..&#39;z&#39;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="19"> + <li class="covered" data-hits="1" data-linenumber="36"> <span class="hits">1</span> <code class="ruby"> Upper = Array(&#39;A&#39;..&#39;Z&#39;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="20"> + <li class="covered" data-hits="1" data-linenumber="37"> <span class="hits">1</span> <code class="ruby"> Digit = Array(&#39;0&#39;..&#39;9&#39;)</code> </li> - <li class="covered" data-hits="37" data-linenumber="21"> + <li class="covered" data-hits="37" data-linenumber="38"> <span class="hits">37</span> <code class="ruby"> Punct = [33..47, 58..64, 91..96, 123..126].map { |r| r.map { |val| val.chr } }.flatten</code> </li> - <li class="covered" data-hits="1" data-linenumber="22"> + <li class="covered" data-hits="1" data-linenumber="39"> <span class="hits">1</span> <code class="ruby"> Hex = Array(&#39;a&#39;..&#39;f&#39;) | Array(&#39;A&#39;..&#39;F&#39;) | Digit</code> </li> - <li class="covered" data-hits="1" data-linenumber="23"> + <li class="covered" data-hits="1" data-linenumber="40"> <span class="hits">1</span> <code class="ruby"> Whitespace = [&#39; &#39;, &quot;\t&quot;, &quot;\n&quot;, &quot;\r&quot;, &quot;\v&quot;, &quot;\f&quot;]</code> </li> - <li class="covered" data-hits="1" data-linenumber="24"> + <li class="covered" data-hits="1" data-linenumber="41"> <span class="hits">1</span> <code class="ruby"> Any = Lower | Upper | Digit | Punct</code> </li> - <li class="never" data-hits="" data-linenumber="25"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="26"> + <li class="never" data-hits="" data-linenumber="43"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="27"> + <li class="never" data-hits="" data-linenumber="44"> <code class="ruby"> # Map of special regex characters, to their associated character sets</code> </li> - <li class="covered" data-hits="1" data-linenumber="28"> + <li class="covered" data-hits="1" data-linenumber="45"> <span class="hits">1</span> <code class="ruby"> BackslashCharMap = {</code> </li> - <li class="never" data-hits="" data-linenumber="29"> + <li class="never" data-hits="" data-linenumber="46"> <code class="ruby"> &#39;d&#39; =&gt; CharSets::Digit,</code> </li> - <li class="never" data-hits="" data-linenumber="30"> + <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"> &#39;D&#39; =&gt; CharSets::Lower | CharSets::Upper | CharSets::Punct,</code> </li> - <li class="never" data-hits="" data-linenumber="31"> + <li class="never" data-hits="" data-linenumber="48"> <code class="ruby"> &#39;w&#39; =&gt; CharSets::Lower | CharSets::Upper | CharSets::Digit | [&#39;_&#39;],</code> </li> - <li class="covered" data-hits="32" data-linenumber="32"> + <li class="covered" data-hits="32" data-linenumber="49"> <span class="hits">32</span> <code class="ruby"> &#39;W&#39; =&gt; CharSets::Punct.reject { |val| val == &#39;_&#39; },</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"> &#39;s&#39; =&gt; CharSets::Whitespace,</code> </li> - <li class="never" data-hits="" data-linenumber="34"> + <li class="never" data-hits="" data-linenumber="51"> <code class="ruby"> &#39;S&#39; =&gt; CharSets::Any - CharSets::Whitespace,</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="52"> <code class="ruby"> &#39;h&#39; =&gt; CharSets::Hex,</code> </li> - <li class="never" data-hits="" data-linenumber="36"> + <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"> &#39;H&#39; =&gt; CharSets::Any - CharSets::Hex,</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="54"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="38"> + <li class="never" data-hits="" data-linenumber="55"> <code class="ruby"> &#39;t&#39; =&gt; [&quot;\t&quot;], # tab</code> </li> - <li class="never" data-hits="" data-linenumber="39"> + <li class="never" data-hits="" data-linenumber="56"> <code class="ruby"> &#39;n&#39; =&gt; [&quot;\n&quot;], # new line</code> </li> - <li class="never" data-hits="" data-linenumber="40"> + <li class="never" data-hits="" data-linenumber="57"> <code class="ruby"> &#39;r&#39; =&gt; [&quot;\r&quot;], # carriage return</code> </li> - <li class="never" data-hits="" data-linenumber="41"> + <li class="never" data-hits="" data-linenumber="58"> <code class="ruby"> &#39;f&#39; =&gt; [&quot;\f&quot;], # form feed</code> </li> - <li class="never" data-hits="" data-linenumber="42"> + <li class="never" data-hits="" data-linenumber="59"> <code class="ruby"> &#39;a&#39; =&gt; [&quot;\a&quot;], # alarm</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="never" data-hits="" data-linenumber="60"> <code class="ruby"> &#39;v&#39; =&gt; [&quot;\v&quot;], # vertical tab</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> &#39;e&#39; =&gt; [&quot;\e&quot;], # escape</code> </li> - <li class="never" data-hits="" data-linenumber="45"> + <li class="never" data-hits="" data-linenumber="62"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="46"> + <li class="never" data-hits="" data-linenumber="63"> <code class="ruby">end</code> </li> - <li class="never" data-hits="" data-linenumber="47"> + <li class="never" data-hits="" data-linenumber="64"> <code class="ruby"></code> </li> @@ -643,12 +781,12 @@ <div class="source_table" id="1bb4101b0e3c014469af0221a5549cd762b969cb"> <div class="header"> <h3>lib/regexp-examples/exceptions.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>4</b> relevant lines. - <span class="green"><b>4</b> lines covered</span> and + <b>5</b> relevant lines. + <span class="green"><b>5</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -676,13 +814,19 @@ <span class="hits">1</span> <code class="ruby"> class IllegalSyntaxError &lt; Error; end</code> </li> - <li class="never" data-hits="" data-linenumber="5"> + <li class="covered" data-hits="1" data-linenumber="5"> + <span class="hits">1</span> + <code class="ruby"> class BackrefNotFound &lt; Error; end</code> + </li> + + <li class="never" data-hits="" data-linenumber="6"> + <code class="ruby">end</code> </li> </ol> </pre> @@ -691,12 +835,12 @@ <div class="source_table" id="a6c87537a3f20f2e6e7fc1c61e4c6c791987b6f8"> <div class="header"> <h3>lib/regexp-examples/groups.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>84</b> relevant lines. - <span class="green"><b>84</b> lines covered</span> and + <b>82</b> relevant lines. + <span class="green"><b>82</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -742,42 +886,42 @@ <span class="hits">1</span> <code class="ruby"> def initialize(result, group_id = nil, subgroups = [])</code> </li> - <li class="covered" data-hits="1882" data-linenumber="8"> - <span class="hits">1882</span> + <li class="covered" data-hits="1491" data-linenumber="8"> + <span class="hits">1491</span> <code class="ruby"> @group_id = group_id</code> </li> - <li class="covered" data-hits="1882" data-linenumber="9"> - <span class="hits">1882</span> + <li class="covered" data-hits="1491" data-linenumber="9"> + <span class="hits">1491</span> <code class="ruby"> @subgroups = subgroups</code> </li> - <li class="covered" data-hits="1882" data-linenumber="10"> - <span class="hits">1882</span> + <li class="covered" data-hits="1491" data-linenumber="10"> + <span class="hits">1491</span> <code class="ruby"> if result.respond_to?(:group_id)</code> </li> - <li class="covered" data-hits="142" data-linenumber="11"> - <span class="hits">142</span> + <li class="covered" data-hits="155" data-linenumber="11"> + <span class="hits">155</span> <code class="ruby"> @subgroups = result.all_subgroups</code> </li> <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1882" data-linenumber="13"> - <span class="hits">1882</span> + <li class="covered" data-hits="1491" data-linenumber="13"> + <span class="hits">1491</span> <code class="ruby"> super(result)</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -796,12 +940,12 @@ <span class="hits">1</span> <code class="ruby"> def all_subgroups</code> </li> - <li class="covered" data-hits="1939" data-linenumber="17"> - <span class="hits">1939</span> + <li class="covered" data-hits="2213" data-linenumber="17"> + <span class="hits">2213</span> <code class="ruby"> [self, subgroups].flatten.reject { |subgroup| subgroup.group_id.nil? }</code> </li> <li class="never" data-hits="" data-linenumber="18"> @@ -811,854 +955,812 @@ </li> <li class="never" data-hits="" data-linenumber="19"> - <code class="ruby"></code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="20"> - <code class="ruby"> # Overridden in order to preserve the @group_id and @subgroups</code> - </li> - - <li class="never" data-hits="" data-linenumber="21"> - - - <code class="ruby"> # Used by BaseGroup (which, in turn, is used by all Group objects)</code> - </li> - - <li class="covered" data-hits="1" data-linenumber="22"> - <span class="hits">1</span> - - <code class="ruby"> def *(int)</code> - </li> - - <li class="covered" data-hits="499" data-linenumber="23"> - <span class="hits">499</span> - - <code class="ruby"> self.class.new(super.to_s, group_id, subgroups)</code> - </li> - - <li class="never" data-hits="" data-linenumber="24"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="25"> - - - <code class="ruby"> end</code> - </li> - - <li class="never" data-hits="" data-linenumber="26"> - - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="27"> + <li class="covered" data-hits="1" data-linenumber="21"> <span class="hits">1</span> <code class="ruby"> class SingleCharGroup</code> </li> - <li class="covered" data-hits="1" data-linenumber="28"> + <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> <code class="ruby"> def initialize(char)</code> </li> - <li class="covered" data-hits="280" data-linenumber="29"> - <span class="hits">280</span> + <li class="covered" data-hits="287" data-linenumber="23"> + <span class="hits">287</span> <code class="ruby"> @char = char</code> </li> - <li class="never" data-hits="" data-linenumber="30"> + <li class="never" data-hits="" data-linenumber="24"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="31"> + <li class="covered" data-hits="1" data-linenumber="25"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="242" data-linenumber="32"> - <span class="hits">242</span> + <li class="covered" data-hits="249" data-linenumber="26"> + <span class="hits">249</span> <code class="ruby"> [GroupResult.new(@char)]</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="34"> + <li class="never" data-hits="" data-linenumber="28"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="29"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="36"> + <li class="covered" data-hits="1" data-linenumber="30"> <span class="hits">1</span> <code class="ruby"> class CharGroup</code> </li> - <li class="covered" data-hits="1" data-linenumber="37"> + <li class="covered" data-hits="1" data-linenumber="31"> <span class="hits">1</span> <code class="ruby"> def initialize(chars)</code> </li> - <li class="covered" data-hits="40" data-linenumber="38"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="32"> + <span class="hits">41</span> <code class="ruby"> @chars = chars</code> </li> - <li class="covered" data-hits="40" data-linenumber="39"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="33"> + <span class="hits">41</span> <code class="ruby"> if chars[0] == &quot;^&quot;</code> </li> - <li class="covered" data-hits="11" data-linenumber="40"> - <span class="hits">11</span> + <li class="covered" data-hits="10" data-linenumber="34"> + <span class="hits">10</span> <code class="ruby"> @negative = true</code> </li> - <li class="covered" data-hits="11" data-linenumber="41"> - <span class="hits">11</span> + <li class="covered" data-hits="10" data-linenumber="35"> + <span class="hits">10</span> <code class="ruby"> @chars = @chars[1..-1]</code> </li> - <li class="never" data-hits="" data-linenumber="42"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="29" data-linenumber="43"> - <span class="hits">29</span> + <li class="covered" data-hits="31" data-linenumber="37"> + <span class="hits">31</span> <code class="ruby"> @negative = false</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="38"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="45"> + <li class="never" data-hits="" data-linenumber="39"> <code class="ruby"></code> </li> - <li class="covered" data-hits="40" data-linenumber="46"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="40"> + <span class="hits">41</span> <code class="ruby"> init_backslash_chars</code> </li> - <li class="covered" data-hits="40" data-linenumber="47"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="41"> + <span class="hits">41</span> <code class="ruby"> init_ranges</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="43"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="50"> + <li class="covered" data-hits="1" data-linenumber="44"> <span class="hits">1</span> <code class="ruby"> def init_ranges</code> </li> - <li class="never" data-hits="" data-linenumber="51"> + <li class="never" data-hits="" data-linenumber="45"> <code class="ruby"> # save first and last &quot;-&quot; if present</code> </li> - <li class="covered" data-hits="40" data-linenumber="52"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="46"> + <span class="hits">41</span> <code class="ruby"> first = nil</code> </li> - <li class="covered" data-hits="40" data-linenumber="53"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="47"> + <span class="hits">41</span> <code class="ruby"> last = nil</code> </li> - <li class="covered" data-hits="40" data-linenumber="54"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="48"> + <span class="hits">41</span> <code class="ruby"> first = @chars.shift if @chars.first == &quot;-&quot;</code> </li> - <li class="covered" data-hits="40" data-linenumber="55"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="49"> + <span class="hits">41</span> <code class="ruby"> last = @chars.pop if @chars.last == &quot;-&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="56"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"> # Replace all instances of e.g. [&quot;a&quot;, &quot;-&quot;, &quot;z&quot;] with [&quot;a&quot;, &quot;b&quot;, ..., &quot;z&quot;]</code> </li> - <li class="covered" data-hits="40" data-linenumber="57"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="51"> + <span class="hits">41</span> <code class="ruby"> while i = @chars.index(&quot;-&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="52"> <code class="ruby"> # Prevent infinite loops from expanding [&quot;,&quot;, &quot;-&quot;, &quot;.&quot;] to itself</code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"> # (Since &quot;,&quot;.ord = 44, &quot;-&quot;.ord = 45, &quot;.&quot;.ord = 46)</code> </li> - <li class="covered" data-hits="26" data-linenumber="60"> - <span class="hits">26</span> + <li class="covered" data-hits="25" data-linenumber="54"> + <span class="hits">25</span> <code class="ruby"> if (@chars[i-1] == &#39;,&#39; &amp;&amp; @chars[i+1] == &#39;.&#39;)</code> </li> - <li class="covered" data-hits="15" data-linenumber="61"> - <span class="hits">15</span> + <li class="covered" data-hits="14" data-linenumber="55"> + <span class="hits">14</span> <code class="ruby"> first = &#39;-&#39;</code> </li> - <li class="covered" data-hits="15" data-linenumber="62"> - <span class="hits">15</span> + <li class="covered" data-hits="14" data-linenumber="56"> + <span class="hits">14</span> <code class="ruby"> @chars.delete_at(i)</code> </li> - <li class="never" data-hits="" data-linenumber="63"> + <li class="never" data-hits="" data-linenumber="57"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="11" data-linenumber="64"> + <li class="covered" data-hits="11" data-linenumber="58"> <span class="hits">11</span> <code class="ruby"> @chars[i-1..i+1] = (@chars[i-1]..@chars[i+1]).to_a</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="59"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="66"> + <li class="never" data-hits="" data-linenumber="60"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="67"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> # restore them back</code> </li> - <li class="covered" data-hits="40" data-linenumber="68"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="62"> + <span class="hits">41</span> <code class="ruby"> @chars.unshift(first) if first</code> </li> - <li class="covered" data-hits="40" data-linenumber="69"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="63"> + <span class="hits">41</span> <code class="ruby"> @chars.push(last) if last</code> </li> - <li class="never" data-hits="" data-linenumber="70"> + <li class="never" data-hits="" data-linenumber="64"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="71"> + <li class="never" data-hits="" data-linenumber="65"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="72"> + <li class="covered" data-hits="1" data-linenumber="66"> <span class="hits">1</span> <code class="ruby"> def init_backslash_chars</code> </li> - <li class="covered" data-hits="40" data-linenumber="73"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="67"> + <span class="hits">41</span> <code class="ruby"> @chars.each_with_index do |char, i|</code> </li> - <li class="covered" data-hits="1430" data-linenumber="74"> - <span class="hits">1430</span> + <li class="covered" data-hits="1348" data-linenumber="68"> + <span class="hits">1348</span> <code class="ruby"> if char == &quot;\\&quot;</code> </li> - <li class="covered" data-hits="32" data-linenumber="75"> - <span class="hits">32</span> + <li class="covered" data-hits="30" data-linenumber="69"> + <span class="hits">30</span> <code class="ruby"> if BackslashCharMap.keys.include?(@chars[i+1])</code> </li> - <li class="covered" data-hits="22" data-linenumber="76"> - <span class="hits">22</span> + <li class="covered" data-hits="20" data-linenumber="70"> + <span class="hits">20</span> <code class="ruby"> @chars[i..i+1] = move_backslash_to_front( BackslashCharMap[@chars[i+1]] )</code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="71"> <code class="ruby"> elsif @chars[i+1] == &#39;b&#39;</code> </li> - <li class="covered" data-hits="1" data-linenumber="78"> + <li class="covered" data-hits="1" data-linenumber="72"> <span class="hits">1</span> <code class="ruby"> @chars[i..i+1] = &quot;\b&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="79"> + <li class="never" data-hits="" data-linenumber="73"> <code class="ruby"> elsif @chars[i+1] == &quot;\\&quot;</code> </li> - <li class="covered" data-hits="2" data-linenumber="80"> + <li class="covered" data-hits="2" data-linenumber="74"> <span class="hits">2</span> <code class="ruby"> @chars.delete_at(i+1)</code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="7" data-linenumber="82"> + <li class="covered" data-hits="7" data-linenumber="76"> <span class="hits">7</span> <code class="ruby"> @chars.delete_at(i)</code> </li> - <li class="never" data-hits="" data-linenumber="83"> + <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="78"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="85"> + <li class="never" data-hits="" data-linenumber="79"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="86"> + <li class="never" data-hits="" data-linenumber="80"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="81"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="88"> + <li class="covered" data-hits="1" data-linenumber="82"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="40" data-linenumber="89"> - <span class="hits">40</span> + <li class="covered" data-hits="41" data-linenumber="83"> + <span class="hits">41</span> <code class="ruby"> (@negative ? (CharSets::Any - @chars) : @chars).map do |result|</code> </li> - <li class="covered" data-hits="590" data-linenumber="90"> - <span class="hits">590</span> + <li class="covered" data-hits="602" data-linenumber="84"> + <span class="hits">602</span> <code class="ruby"> GroupResult.new(result)</code> </li> - <li class="never" data-hits="" data-linenumber="91"> + <li class="never" data-hits="" data-linenumber="85"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="86"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="93"> + <li class="never" data-hits="" data-linenumber="87"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="88"> <span class="hits">1</span> <code class="ruby"> private</code> </li> - <li class="covered" data-hits="1" data-linenumber="95"> + <li class="covered" data-hits="1" data-linenumber="89"> <span class="hits">1</span> <code class="ruby"> def move_backslash_to_front(chars)</code> </li> - <li class="covered" data-hits="547" data-linenumber="96"> - <span class="hits">547</span> + <li class="covered" data-hits="534" data-linenumber="90"> + <span class="hits">534</span> <code class="ruby"> if index = chars.index { |char| char == &#39;\\&#39; }</code> </li> - <li class="covered" data-hits="10" data-linenumber="97"> - <span class="hits">10</span> + <li class="covered" data-hits="9" data-linenumber="91"> + <span class="hits">9</span> <code class="ruby"> chars.unshift chars.delete_at(index)</code> </li> - <li class="never" data-hits="" data-linenumber="98"> + <li class="never" data-hits="" data-linenumber="92"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="22" data-linenumber="99"> - <span class="hits">22</span> + <li class="covered" data-hits="20" data-linenumber="93"> + <span class="hits">20</span> <code class="ruby"> chars</code> </li> - <li class="never" data-hits="" data-linenumber="100"> + <li class="never" data-hits="" data-linenumber="94"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="101"> + <li class="never" data-hits="" data-linenumber="95"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="102"> + <li class="never" data-hits="" data-linenumber="96"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="103"> + <li class="covered" data-hits="1" data-linenumber="97"> <span class="hits">1</span> <code class="ruby"> class DotGroup</code> </li> - <li class="covered" data-hits="1" data-linenumber="104"> + <li class="covered" data-hits="1" data-linenumber="98"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="1" data-linenumber="105"> + <li class="covered" data-hits="1" data-linenumber="99"> <span class="hits">1</span> <code class="ruby"> CharSets::Any.map do |result|</code> </li> - <li class="covered" data-hits="94" data-linenumber="106"> + <li class="covered" data-hits="94" data-linenumber="100"> <span class="hits">94</span> <code class="ruby"> GroupResult.new(result)</code> </li> - <li class="never" data-hits="" data-linenumber="107"> + <li class="never" data-hits="" data-linenumber="101"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="108"> + <li class="never" data-hits="" data-linenumber="102"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="109"> + <li class="never" data-hits="" data-linenumber="103"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="110"> + <li class="never" data-hits="" data-linenumber="104"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="111"> + <li class="covered" data-hits="1" data-linenumber="105"> <span class="hits">1</span> <code class="ruby"> class MultiGroup</code> </li> - <li class="covered" data-hits="1" data-linenumber="112"> + <li class="covered" data-hits="1" data-linenumber="106"> <span class="hits">1</span> <code class="ruby"> attr_reader :group_id</code> </li> - <li class="covered" data-hits="1" data-linenumber="113"> + <li class="covered" data-hits="1" data-linenumber="107"> <span class="hits">1</span> <code class="ruby"> def initialize(groups, group_id)</code> </li> - <li class="covered" data-hits="41" data-linenumber="114"> - <span class="hits">41</span> + <li class="covered" data-hits="45" data-linenumber="108"> + <span class="hits">45</span> <code class="ruby"> @groups = groups</code> </li> - <li class="covered" data-hits="41" data-linenumber="115"> - <span class="hits">41</span> + <li class="covered" data-hits="45" data-linenumber="109"> + <span class="hits">45</span> <code class="ruby"> @group_id = group_id</code> </li> - <li class="never" data-hits="" data-linenumber="116"> + <li class="never" data-hits="" data-linenumber="110"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="117"> + <li class="never" data-hits="" data-linenumber="111"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="118"> + <li class="never" data-hits="" data-linenumber="112"> <code class="ruby"> # Generates the result of each contained group</code> </li> - <li class="never" data-hits="" data-linenumber="119"> + <li class="never" data-hits="" data-linenumber="113"> <code class="ruby"> # and adds the filled group of each result to</code> </li> - <li class="never" data-hits="" data-linenumber="120"> + <li class="never" data-hits="" data-linenumber="114"> <code class="ruby"> # itself</code> </li> - <li class="covered" data-hits="1" data-linenumber="121"> + <li class="covered" data-hits="1" data-linenumber="115"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="186" data-linenumber="122"> - <span class="hits">186</span> + <li class="covered" data-hits="194" data-linenumber="116"> + <span class="hits">194</span> <code class="ruby"> strings = @groups.map {|repeater| repeater.result}</code> </li> - <li class="covered" data-hits="41" data-linenumber="123"> - <span class="hits">41</span> + <li class="covered" data-hits="45" data-linenumber="117"> + <span class="hits">45</span> - <code class="ruby"> RegexpExamples::permutations_of_strings(strings).map do |result|</code> + <code class="ruby"> RegexpExamples.permutations_of_strings(strings).map do |result|</code> </li> - <li class="covered" data-hits="113" data-linenumber="124"> - <span class="hits">113</span> + <li class="covered" data-hits="119" data-linenumber="118"> + <span class="hits">119</span> <code class="ruby"> GroupResult.new(result, group_id)</code> </li> - <li class="never" data-hits="" data-linenumber="125"> + <li class="never" data-hits="" data-linenumber="119"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="126"> + <li class="never" data-hits="" data-linenumber="120"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="127"> + <li class="never" data-hits="" data-linenumber="121"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="128"> + <li class="never" data-hits="" data-linenumber="122"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="129"> + <li class="covered" data-hits="1" data-linenumber="123"> <span class="hits">1</span> <code class="ruby"> class MultiGroupEnd</code> </li> - <li class="never" data-hits="" data-linenumber="130"> + <li class="never" data-hits="" data-linenumber="124"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="131"> + <li class="never" data-hits="" data-linenumber="125"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="132"> + <li class="covered" data-hits="1" data-linenumber="126"> <span class="hits">1</span> <code class="ruby"> class OrGroup</code> </li> - <li class="covered" data-hits="1" data-linenumber="133"> + <li class="covered" data-hits="1" data-linenumber="127"> <span class="hits">1</span> <code class="ruby"> def initialize(left_repeaters, right_repeaters)</code> </li> - <li class="covered" data-hits="9" data-linenumber="134"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="128"> + <span class="hits">11</span> <code class="ruby"> @left_repeaters = left_repeaters</code> </li> - <li class="covered" data-hits="9" data-linenumber="135"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="129"> + <span class="hits">11</span> <code class="ruby"> @right_repeaters = right_repeaters</code> </li> - <li class="never" data-hits="" data-linenumber="136"> + <li class="never" data-hits="" data-linenumber="130"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="137"> + <li class="never" data-hits="" data-linenumber="131"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="138"> + <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="139"> + <li class="covered" data-hits="1" data-linenumber="133"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="9" data-linenumber="140"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="134"> + <span class="hits">11</span> - <code class="ruby"> left_result = RegexpExamples::map_results(@left_repeaters)</code> + <code class="ruby"> left_result = RegexpExamples.map_results(@left_repeaters)</code> </li> - <li class="covered" data-hits="9" data-linenumber="141"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="135"> + <span class="hits">11</span> - <code class="ruby"> right_result = RegexpExamples::map_results(@right_repeaters)</code> + <code class="ruby"> right_result = RegexpExamples.map_results(@right_repeaters)</code> </li> - <li class="never" data-hits="" data-linenumber="142"> + <li class="covered" data-hits="11" data-linenumber="136"> + <span class="hits">11</span> - - <code class="ruby"> </code> - </li> - - <li class="covered" data-hits="9" data-linenumber="143"> - <span class="hits">9</span> - <code class="ruby"> left_result.concat(right_result).flatten.uniq.map do |result|</code> </li> - <li class="covered" data-hits="29" data-linenumber="144"> - <span class="hits">29</span> + <li class="covered" data-hits="36" data-linenumber="137"> + <span class="hits">36</span> <code class="ruby"> GroupResult.new(result)</code> </li> - <li class="never" data-hits="" data-linenumber="145"> + <li class="never" data-hits="" data-linenumber="138"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="146"> + <li class="never" data-hits="" data-linenumber="139"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="147"> + <li class="never" data-hits="" data-linenumber="140"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="148"> + <li class="never" data-hits="" data-linenumber="141"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="149"> + <li class="covered" data-hits="1" data-linenumber="142"> <span class="hits">1</span> <code class="ruby"> class BackReferenceGroup</code> </li> - <li class="covered" data-hits="1" data-linenumber="150"> + <li class="covered" data-hits="1" data-linenumber="143"> <span class="hits">1</span> <code class="ruby"> attr_reader :id</code> </li> - <li class="covered" data-hits="1" data-linenumber="151"> + <li class="covered" data-hits="1" data-linenumber="144"> <span class="hits">1</span> <code class="ruby"> def initialize(id)</code> </li> - <li class="covered" data-hits="20" data-linenumber="152"> - <span class="hits">20</span> + <li class="covered" data-hits="22" data-linenumber="145"> + <span class="hits">22</span> <code class="ruby"> @id = id</code> </li> - <li class="never" data-hits="" data-linenumber="153"> + <li class="never" data-hits="" data-linenumber="146"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="154"> + <li class="never" data-hits="" data-linenumber="147"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="155"> + <li class="covered" data-hits="1" data-linenumber="148"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="20" data-linenumber="156"> - <span class="hits">20</span> + <li class="covered" data-hits="22" data-linenumber="149"> + <span class="hits">22</span> <code class="ruby"> [ GroupResult.new(&quot;__#{@id}__&quot;) ]</code> </li> - <li class="never" data-hits="" data-linenumber="157"> + <li class="never" data-hits="" data-linenumber="150"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="158"> + <li class="never" data-hits="" data-linenumber="151"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="159"> + <li class="never" data-hits="" data-linenumber="152"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="160"> + <li class="never" data-hits="" data-linenumber="153"> <code class="ruby">end</code> </li> @@ -1723,11 +1825,11 @@ </li> <li class="never" data-hits="" data-linenumber="8"> - <code class="ruby"> # permutations_of_strings [ [&#39;a&#39;], [&#39;b&#39;], [&#39;c&#39;, &#39;d&#39;, &#39;e&#39;] ] #=&gt; [&#39;acb&#39;, &#39;abd&#39;, &#39;abe&#39;]</code> + <code class="ruby"> # permutations_of_strings [ [&#39;a&#39;], [&#39;b&#39;], [&#39;c&#39;, &#39;d&#39;, &#39;e&#39;] ] #=&gt; [&#39;abc&#39;, &#39;abd&#39;, &#39;abe&#39;]</code> </li> <li class="never" data-hits="" data-linenumber="9"> @@ -1738,30 +1840,30 @@ <span class="hits">1</span> <code class="ruby"> def self.permutations_of_strings(arrays_of_strings)</code> </li> - <li class="covered" data-hits="353" data-linenumber="11"> - <span class="hits">353</span> + <li class="covered" data-hits="813" data-linenumber="11"> + <span class="hits">813</span> <code class="ruby"> first = arrays_of_strings.shift</code> </li> - <li class="covered" data-hits="353" data-linenumber="12"> - <span class="hits">353</span> + <li class="covered" data-hits="813" data-linenumber="12"> + <span class="hits">813</span> <code class="ruby"> return first if arrays_of_strings.empty?</code> </li> - <li class="covered" data-hits="205" data-linenumber="13"> - <span class="hits">205</span> + <li class="covered" data-hits="256" data-linenumber="13"> + <span class="hits">256</span> <code class="ruby"> first.product( permutations_of_strings(arrays_of_strings) ).map do |result|</code> </li> - <li class="covered" data-hits="295" data-linenumber="14"> - <span class="hits">295</span> + <li class="covered" data-hits="350" data-linenumber="14"> + <span class="hits">350</span> <code class="ruby"> join_preserving_capture_groups(result)</code> </li> <li class="never" data-hits="" data-linenumber="15"> @@ -1786,18 +1888,18 @@ <span class="hits">1</span> <code class="ruby"> def self.join_preserving_capture_groups(result)</code> </li> - <li class="covered" data-hits="295" data-linenumber="19"> - <span class="hits">295</span> + <li class="covered" data-hits="350" data-linenumber="19"> + <span class="hits">350</span> <code class="ruby"> result.flatten!</code> </li> - <li class="covered" data-hits="295" data-linenumber="20"> - <span class="hits">295</span> + <li class="covered" data-hits="350" data-linenumber="20"> + <span class="hits">350</span> <code class="ruby"> subgroups = result</code> </li> <li class="never" data-hits="" data-linenumber="21"> @@ -1810,12 +1912,12 @@ <code class="ruby"> .flatten</code> </li> - <li class="covered" data-hits="295" data-linenumber="23"> - <span class="hits">295</span> + <li class="covered" data-hits="350" data-linenumber="23"> + <span class="hits">350</span> <code class="ruby"> GroupResult.new(result.join, nil, subgroups)</code> </li> <li class="never" data-hits="" data-linenumber="24"> @@ -1840,26 +1942,26 @@ <code class="ruby"> repeaters</code> </li> - <li class="covered" data-hits="208" data-linenumber="28"> - <span class="hits">208</span> + <li class="covered" data-hits="220" data-linenumber="28"> + <span class="hits">220</span> <code class="ruby"> .map {|repeater| repeater.result}</code> </li> - <li class="covered" data-hits="107" data-linenumber="29"> - <span class="hits">107</span> + <li class="covered" data-hits="117" data-linenumber="29"> + <span class="hits">117</span> <code class="ruby"> .instance_eval do |partial_results|</code> </li> - <li class="covered" data-hits="107" data-linenumber="30"> - <span class="hits">107</span> + <li class="covered" data-hits="117" data-linenumber="30"> + <span class="hits">117</span> - <code class="ruby"> RegexpExamples::permutations_of_strings(partial_results)</code> + <code class="ruby"> RegexpExamples.permutations_of_strings(partial_results)</code> </li> <li class="never" data-hits="" data-linenumber="31"> @@ -1891,12 +1993,12 @@ <div class="source_table" id="d0056bbc5aec01e743374a8696b2086c03bae8f0"> <div class="header"> <h3>lib/regexp-examples/parser.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>136</b> relevant lines. - <span class="green"><b>136</b> lines covered</span> and + <b>137</b> relevant lines. + <span class="green"><b>137</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -1921,1448 +2023,1472 @@ </li> <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> - <code class="ruby"> def initialize(regexp_string)</code> + <code class="ruby"> def initialize(regexp_string, options={})</code> </li> - <li class="covered" data-hits="106" data-linenumber="5"> - <span class="hits">106</span> + <li class="covered" data-hits="112" data-linenumber="5"> + <span class="hits">112</span> <code class="ruby"> @regexp_string = regexp_string</code> </li> - <li class="covered" data-hits="106" data-linenumber="6"> - <span class="hits">106</span> + <li class="covered" data-hits="112" data-linenumber="6"> + <span class="hits">112</span> <code class="ruby"> @num_groups = 0</code> </li> - <li class="covered" data-hits="106" data-linenumber="7"> - <span class="hits">106</span> + <li class="covered" data-hits="112" data-linenumber="7"> + <span class="hits">112</span> <code class="ruby"> @current_position = 0</code> </li> - <li class="never" data-hits="" data-linenumber="8"> + <li class="covered" data-hits="112" data-linenumber="8"> + <span class="hits">112</span> + <code class="ruby"> RegexpExamples::ResultCountLimiters.configure!(</code> + </li> + + <li class="never" data-hits="" data-linenumber="9"> + + <code class="ruby"> options[:max_repeater_variance],</code> + </li> + + <li class="never" data-hits="" data-linenumber="10"> + + + <code class="ruby"> options[:max_group_results]</code> + </li> + + <li class="never" data-hits="" data-linenumber="11"> + + + <code class="ruby"> )</code> + </li> + + <li class="never" data-hits="" data-linenumber="12"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="9"> + <li class="never" data-hits="" data-linenumber="13"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="10"> + <li class="covered" data-hits="1" data-linenumber="14"> <span class="hits">1</span> <code class="ruby"> def parse</code> </li> - <li class="covered" data-hits="157" data-linenumber="11"> - <span class="hits">157</span> + <li class="covered" data-hits="169" data-linenumber="15"> + <span class="hits">169</span> <code class="ruby"> repeaters = []</code> </li> - <li class="covered" data-hits="157" data-linenumber="12"> - <span class="hits">157</span> + <li class="covered" data-hits="169" data-linenumber="16"> + <span class="hits">169</span> <code class="ruby"> while @current_position &lt; regexp_string.length</code> </li> - <li class="covered" data-hits="453" data-linenumber="13"> - <span class="hits">453</span> + <li class="covered" data-hits="473" data-linenumber="17"> + <span class="hits">473</span> <code class="ruby"> group = parse_group(repeaters)</code> </li> - <li class="covered" data-hits="435" data-linenumber="14"> - <span class="hits">435</span> + <li class="covered" data-hits="455" data-linenumber="18"> + <span class="hits">455</span> <code class="ruby"> break if group.is_a? MultiGroupEnd</code> </li> - <li class="covered" data-hits="394" data-linenumber="15"> - <span class="hits">394</span> + <li class="covered" data-hits="410" data-linenumber="19"> + <span class="hits">410</span> <code class="ruby"> if group.is_a? OrGroup</code> </li> - <li class="covered" data-hits="9" data-linenumber="16"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="20"> + <span class="hits">11</span> <code class="ruby"> return [OneTimeRepeater.new(group)]</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="21"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="385" data-linenumber="18"> - <span class="hits">385</span> + <li class="covered" data-hits="399" data-linenumber="22"> + <span class="hits">399</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="385" data-linenumber="19"> - <span class="hits">385</span> + <li class="covered" data-hits="399" data-linenumber="23"> + <span class="hits">399</span> <code class="ruby"> repeaters &lt;&lt; parse_repeater(group)</code> </li> - <li class="never" data-hits="" data-linenumber="20"> + <li class="never" data-hits="" data-linenumber="24"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="130" data-linenumber="21"> - <span class="hits">130</span> + <li class="covered" data-hits="140" data-linenumber="25"> + <span class="hits">140</span> <code class="ruby"> repeaters</code> </li> - <li class="never" data-hits="" data-linenumber="22"> + <li class="never" data-hits="" data-linenumber="26"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="23"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="24"> + <li class="covered" data-hits="1" data-linenumber="28"> <span class="hits">1</span> <code class="ruby"> private</code> </li> - <li class="never" data-hits="" data-linenumber="25"> + <li class="never" data-hits="" data-linenumber="29"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="26"> + <li class="covered" data-hits="1" data-linenumber="30"> <span class="hits">1</span> <code class="ruby"> def parse_group(repeaters)</code> </li> - <li class="covered" data-hits="453" data-linenumber="27"> - <span class="hits">453</span> + <li class="covered" data-hits="473" data-linenumber="31"> + <span class="hits">473</span> <code class="ruby"> char = regexp_string[@current_position]</code> </li> - <li class="covered" data-hits="453" data-linenumber="28"> - <span class="hits">453</span> + <li class="covered" data-hits="473" data-linenumber="32"> + <span class="hits">473</span> <code class="ruby"> case char</code> </li> - <li class="never" data-hits="" data-linenumber="29"> + <li class="never" data-hits="" data-linenumber="33"> <code class="ruby"> when &#39;(&#39;</code> </li> - <li class="covered" data-hits="46" data-linenumber="30"> - <span class="hits">46</span> + <li class="covered" data-hits="50" data-linenumber="34"> + <span class="hits">50</span> <code class="ruby"> group = parse_multi_group</code> </li> - <li class="never" data-hits="" data-linenumber="31"> + <li class="never" data-hits="" data-linenumber="35"> <code class="ruby"> when &#39;)&#39;</code> </li> - <li class="covered" data-hits="41" data-linenumber="32"> - <span class="hits">41</span> + <li class="covered" data-hits="45" data-linenumber="36"> + <span class="hits">45</span> <code class="ruby"> group = parse_multi_end_group</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"> when &#39;[&#39;</code> </li> - <li class="covered" data-hits="27" data-linenumber="34"> + <li class="covered" data-hits="27" data-linenumber="38"> <span class="hits">27</span> <code class="ruby"> group = parse_char_group</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="39"> <code class="ruby"> when &#39;.&#39;</code> </li> - <li class="covered" data-hits="4" data-linenumber="36"> + <li class="covered" data-hits="4" data-linenumber="40"> <span class="hits">4</span> <code class="ruby"> group = parse_dot_group</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="41"> <code class="ruby"> when &#39;|&#39;</code> </li> - <li class="covered" data-hits="9" data-linenumber="38"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="42"> + <span class="hits">11</span> <code class="ruby"> group = parse_or_group(repeaters)</code> </li> - <li class="never" data-hits="" data-linenumber="39"> + <li class="never" data-hits="" data-linenumber="43"> <code class="ruby"> when &#39;\\&#39;</code> </li> - <li class="covered" data-hits="63" data-linenumber="40"> - <span class="hits">63</span> + <li class="covered" data-hits="66" data-linenumber="44"> + <span class="hits">66</span> <code class="ruby"> group = parse_after_backslash_group</code> </li> - <li class="never" data-hits="" data-linenumber="41"> + <li class="never" data-hits="" data-linenumber="45"> <code class="ruby"> when &#39;^&#39;, &#39;A&#39;</code> </li> - <li class="covered" data-hits="2" data-linenumber="42"> + <li class="covered" data-hits="2" data-linenumber="46"> <span class="hits">2</span> <code class="ruby"> if @current_position == 0</code> </li> - <li class="covered" data-hits="1" data-linenumber="43"> + <li class="covered" data-hits="1" data-linenumber="47"> <span class="hits">1</span> <code class="ruby"> group = parse_single_char_group(&#39;&#39;) # Ignore the &quot;illegal&quot; character</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="48"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="1" data-linenumber="45"> + <li class="covered" data-hits="1" data-linenumber="49"> <span class="hits">1</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Anchors cannot be supported, as they are not regular&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="46"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="47"> + <li class="never" data-hits="" data-linenumber="51"> <code class="ruby"> when &#39;$&#39;, &#39;z&#39;, &#39;Z&#39;</code> </li> - <li class="covered" data-hits="2" data-linenumber="48"> + <li class="covered" data-hits="2" data-linenumber="52"> <span class="hits">2</span> <code class="ruby"> if @current_position == (regexp_string.length - 1)</code> </li> - <li class="covered" data-hits="1" data-linenumber="49"> + <li class="covered" data-hits="1" data-linenumber="53"> <span class="hits">1</span> <code class="ruby"> group = parse_single_char_group(&#39;&#39;) # Ignore the &quot;illegal&quot; character</code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="never" data-hits="" data-linenumber="54"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="1" data-linenumber="51"> + <li class="covered" data-hits="1" data-linenumber="55"> <span class="hits">1</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Anchors cannot be supported, as they are not regular&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="52"> + <li class="never" data-hits="" data-linenumber="56"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="57"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="259" data-linenumber="54"> - <span class="hits">259</span> + <li class="covered" data-hits="266" data-linenumber="58"> + <span class="hits">266</span> <code class="ruby"> group = parse_single_char_group(char)</code> </li> - <li class="never" data-hits="" data-linenumber="55"> + <li class="never" data-hits="" data-linenumber="59"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="435" data-linenumber="56"> - <span class="hits">435</span> + <li class="covered" data-hits="455" data-linenumber="60"> + <span class="hits">455</span> <code class="ruby"> group</code> </li> - <li class="never" data-hits="" data-linenumber="57"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="62"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="59"> + <li class="covered" data-hits="1" data-linenumber="63"> <span class="hits">1</span> <code class="ruby"> def parse_after_backslash_group</code> </li> - <li class="covered" data-hits="63" data-linenumber="60"> - <span class="hits">63</span> + <li class="covered" data-hits="66" data-linenumber="64"> + <span class="hits">66</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="never" data-hits="" data-linenumber="61"> + <li class="never" data-hits="" data-linenumber="65"> <code class="ruby"> case</code> </li> - <li class="never" data-hits="" data-linenumber="62"> + <li class="never" data-hits="" data-linenumber="66"> <code class="ruby"> when rest_of_string =~ /\A(\d+)/</code> </li> - <li class="covered" data-hits="19" data-linenumber="63"> - <span class="hits">19</span> + <li class="covered" data-hits="21" data-linenumber="67"> + <span class="hits">21</span> <code class="ruby"> @current_position += ($1.length - 1) # In case of 10+ backrefs!</code> </li> - <li class="covered" data-hits="19" data-linenumber="64"> - <span class="hits">19</span> + <li class="covered" data-hits="21" data-linenumber="68"> + <span class="hits">21</span> <code class="ruby"> group = parse_backreference_group($1)</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="69"> <code class="ruby"> when rest_of_string =~ /\Ak&lt;([^&gt;]+)&gt;/ # Named capture group</code> </li> - <li class="covered" data-hits="1" data-linenumber="66"> + <li class="covered" data-hits="1" data-linenumber="70"> <span class="hits">1</span> <code class="ruby"> @current_position += ($1.length + 2)</code> </li> - <li class="covered" data-hits="1" data-linenumber="67"> + <li class="covered" data-hits="1" data-linenumber="71"> <span class="hits">1</span> <code class="ruby"> group = parse_backreference_group($1)</code> </li> - <li class="never" data-hits="" data-linenumber="68"> + <li class="never" data-hits="" data-linenumber="72"> <code class="ruby"> when BackslashCharMap.keys.include?(regexp_string[@current_position])</code> </li> - <li class="covered" data-hits="14" data-linenumber="69"> - <span class="hits">14</span> + <li class="covered" data-hits="15" data-linenumber="73"> + <span class="hits">15</span> <code class="ruby"> group = CharGroup.new(</code> </li> - <li class="never" data-hits="" data-linenumber="70"> + <li class="never" data-hits="" data-linenumber="74"> <code class="ruby"> # Note: The `.dup` is important, as it prevents modifying the constant, in</code> </li> - <li class="never" data-hits="" data-linenumber="71"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"> # CharGroup#init_ranges (where the &#39;-&#39; is moved to the front)</code> </li> - <li class="never" data-hits="" data-linenumber="72"> + <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"> BackslashCharMap[regexp_string[@current_position]].dup</code> </li> - <li class="never" data-hits="" data-linenumber="73"> + <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="74"> + <li class="never" data-hits="" data-linenumber="78"> <code class="ruby"> when rest_of_string =~ /\A(c|C-)(.)/ # Control character</code> </li> - <li class="covered" data-hits="8" data-linenumber="75"> + <li class="covered" data-hits="8" data-linenumber="79"> <span class="hits">8</span> <code class="ruby"> @current_position += $1.length</code> </li> - <li class="covered" data-hits="8" data-linenumber="76"> + <li class="covered" data-hits="8" data-linenumber="80"> <span class="hits">8</span> <code class="ruby"> group = parse_single_char_group( parse_control_character($2) )</code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="81"> <code class="ruby"> when rest_of_string =~ /\Ax(\h{1,2})/ # Escape sequence</code> </li> - <li class="covered" data-hits="3" data-linenumber="78"> + <li class="covered" data-hits="3" data-linenumber="82"> <span class="hits">3</span> <code class="ruby"> @current_position += $1.length</code> </li> - <li class="covered" data-hits="3" data-linenumber="79"> + <li class="covered" data-hits="3" data-linenumber="83"> <span class="hits">3</span> <code class="ruby"> group = parse_single_char_group( parse_escape_sequence($1) )</code> </li> - <li class="never" data-hits="" data-linenumber="80"> + <li class="never" data-hits="" data-linenumber="84"> <code class="ruby"> when rest_of_string =~ /\Au(\h{4}|\{\h{1,4}\})/ # Unicode sequence</code> </li> - <li class="covered" data-hits="3" data-linenumber="81"> + <li class="covered" data-hits="3" data-linenumber="85"> <span class="hits">3</span> <code class="ruby"> @current_position += $1.length</code> </li> - <li class="covered" data-hits="3" data-linenumber="82"> + <li class="covered" data-hits="3" data-linenumber="86"> <span class="hits">3</span> <code class="ruby"> sequence = $1.match(/\h{1,4}/)[0] # Strip off &quot;{&quot; and &quot;}&quot;</code> </li> - <li class="covered" data-hits="3" data-linenumber="83"> + <li class="covered" data-hits="3" data-linenumber="87"> <span class="hits">3</span> <code class="ruby"> group = parse_single_char_group( parse_unicode_sequence(sequence) )</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="88"> <code class="ruby"> when rest_of_string =~ /\Ap\{([^}]+)\}/ # Named properties</code> </li> - <li class="covered" data-hits="3" data-linenumber="85"> + <li class="covered" data-hits="3" data-linenumber="89"> <span class="hits">3</span> <code class="ruby"> @current_position += ($1.length + 2)</code> </li> - <li class="covered" data-hits="3" data-linenumber="86"> + <li class="covered" data-hits="3" data-linenumber="90"> <span class="hits">3</span> <code class="ruby"> raise UnsupportedSyntaxError, &quot;Named properties ({\\p#{$1}}) are not yet supported&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="91"> <code class="ruby"> when rest_of_string =~ /\Ag/ # Subexpression call</code> </li> - <li class="never" data-hits="" data-linenumber="88"> + <li class="never" data-hits="" data-linenumber="92"> <code class="ruby"> # TODO: Should this be IllegalSyntaxError ?</code> </li> - <li class="covered" data-hits="1" data-linenumber="89"> + <li class="covered" data-hits="1" data-linenumber="93"> <span class="hits">1</span> <code class="ruby"> raise UnsupportedSyntaxError, &quot;Subexpression calls (\g) are not yet supported&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="90"> + <li class="never" data-hits="" data-linenumber="94"> <code class="ruby"> when rest_of_string =~ /\A[GbB]/ # Anchors</code> </li> - <li class="covered" data-hits="3" data-linenumber="91"> + <li class="covered" data-hits="3" data-linenumber="95"> <span class="hits">3</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Anchors cannot be supported, as they are not regular&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="96"> <code class="ruby"> when rest_of_string =~ /\AA/ # Start of string</code> </li> - <li class="covered" data-hits="2" data-linenumber="93"> + <li class="covered" data-hits="2" data-linenumber="97"> <span class="hits">2</span> <code class="ruby"> if @current_position == 1</code> </li> - <li class="covered" data-hits="1" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="98"> <span class="hits">1</span> <code class="ruby"> group = parse_single_char_group(&#39;&#39;) # Ignore the &quot;illegal&quot; character</code> </li> - <li class="never" data-hits="" data-linenumber="95"> + <li class="never" data-hits="" data-linenumber="99"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="1" data-linenumber="96"> + <li class="covered" data-hits="1" data-linenumber="100"> <span class="hits">1</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Anchors cannot be supported, as they are not regular&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="101"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="98"> + <li class="never" data-hits="" data-linenumber="102"> <code class="ruby"> when rest_of_string =~ /\A[zZ]/ # End of string</code> </li> - <li class="covered" data-hits="4" data-linenumber="99"> + <li class="covered" data-hits="4" data-linenumber="103"> <span class="hits">4</span> <code class="ruby"> if @current_position == (regexp_string.length - 1)</code> </li> - <li class="covered" data-hits="2" data-linenumber="100"> + <li class="covered" data-hits="2" data-linenumber="104"> <span class="hits">2</span> <code class="ruby"> group = parse_single_char_group(&#39;&#39;) # Ignore the &quot;illegal&quot; character</code> </li> - <li class="never" data-hits="" data-linenumber="101"> + <li class="never" data-hits="" data-linenumber="105"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="2" data-linenumber="102"> + <li class="covered" data-hits="2" data-linenumber="106"> <span class="hits">2</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Anchors cannot be supported, as they are not regular&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="103"> + <li class="never" data-hits="" data-linenumber="107"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="104"> + <li class="never" data-hits="" data-linenumber="108"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="2" data-linenumber="105"> + <li class="covered" data-hits="2" data-linenumber="109"> <span class="hits">2</span> <code class="ruby"> group = parse_single_char_group( regexp_string[@current_position] )</code> </li> - <li class="covered" data-hits="63" data-linenumber="106"> - <span class="hits">63</span> + <li class="covered" data-hits="66" data-linenumber="110"> + <span class="hits">66</span> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="53" data-linenumber="107"> - <span class="hits">53</span> + <li class="covered" data-hits="56" data-linenumber="111"> + <span class="hits">56</span> <code class="ruby"> group</code> </li> - <li class="never" data-hits="" data-linenumber="108"> + <li class="never" data-hits="" data-linenumber="112"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="109"> + <li class="never" data-hits="" data-linenumber="113"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="110"> + <li class="covered" data-hits="1" data-linenumber="114"> <span class="hits">1</span> <code class="ruby"> def parse_repeater(group)</code> </li> - <li class="covered" data-hits="385" data-linenumber="111"> - <span class="hits">385</span> + <li class="covered" data-hits="399" data-linenumber="115"> + <span class="hits">399</span> <code class="ruby"> char = regexp_string[@current_position]</code> </li> - <li class="covered" data-hits="385" data-linenumber="112"> - <span class="hits">385</span> + <li class="covered" data-hits="399" data-linenumber="116"> + <span class="hits">399</span> <code class="ruby"> case char</code> </li> - <li class="never" data-hits="" data-linenumber="113"> + <li class="never" data-hits="" data-linenumber="117"> <code class="ruby"> when &#39;*&#39;</code> </li> - <li class="covered" data-hits="6" data-linenumber="114"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="118"> + <span class="hits">5</span> <code class="ruby"> repeater = parse_star_repeater(group)</code> </li> - <li class="never" data-hits="" data-linenumber="115"> + <li class="never" data-hits="" data-linenumber="119"> <code class="ruby"> when &#39;+&#39;</code> </li> - <li class="covered" data-hits="5" data-linenumber="116"> - <span class="hits">5</span> + <li class="covered" data-hits="7" data-linenumber="120"> + <span class="hits">7</span> <code class="ruby"> repeater = parse_plus_repeater(group)</code> </li> - <li class="never" data-hits="" data-linenumber="117"> + <li class="never" data-hits="" data-linenumber="121"> <code class="ruby"> when &#39;?&#39;</code> </li> - <li class="covered" data-hits="11" data-linenumber="118"> - <span class="hits">11</span> + <li class="covered" data-hits="13" data-linenumber="122"> + <span class="hits">13</span> <code class="ruby"> repeater = parse_question_mark_repeater(group)</code> </li> - <li class="never" data-hits="" data-linenumber="119"> + <li class="never" data-hits="" data-linenumber="123"> <code class="ruby"> when &#39;{&#39;</code> </li> - <li class="covered" data-hits="6" data-linenumber="120"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="124"> + <span class="hits">9</span> <code class="ruby"> repeater = parse_range_repeater(group)</code> </li> - <li class="never" data-hits="" data-linenumber="121"> + <li class="never" data-hits="" data-linenumber="125"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="357" data-linenumber="122"> - <span class="hits">357</span> + <li class="covered" data-hits="365" data-linenumber="126"> + <span class="hits">365</span> <code class="ruby"> repeater = parse_one_time_repeater(group)</code> </li> - <li class="never" data-hits="" data-linenumber="123"> + <li class="never" data-hits="" data-linenumber="127"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="385" data-linenumber="124"> - <span class="hits">385</span> + <li class="covered" data-hits="399" data-linenumber="128"> + <span class="hits">399</span> <code class="ruby"> repeater</code> </li> - <li class="never" data-hits="" data-linenumber="125"> + <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="126"> + <li class="never" data-hits="" data-linenumber="130"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="127"> + <li class="covered" data-hits="1" data-linenumber="131"> <span class="hits">1</span> <code class="ruby"> def parse_multi_group</code> </li> - <li class="covered" data-hits="46" data-linenumber="128"> - <span class="hits">46</span> + <li class="covered" data-hits="50" data-linenumber="132"> + <span class="hits">50</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="46" data-linenumber="129"> - <span class="hits">46</span> + <li class="covered" data-hits="50" data-linenumber="133"> + <span class="hits">50</span> <code class="ruby"> @num_groups += 1</code> </li> - <li class="covered" data-hits="46" data-linenumber="130"> - <span class="hits">46</span> + <li class="covered" data-hits="50" data-linenumber="134"> + <span class="hits">50</span> <code class="ruby"> group_id = nil # init</code> </li> - <li class="covered" data-hits="46" data-linenumber="131"> - <span class="hits">46</span> + <li class="covered" data-hits="50" data-linenumber="135"> + <span class="hits">50</span> <code class="ruby"> rest_of_string.match(/\A(\?)?(:|!|=|&lt;(!|=|[^!=][^&gt;]*))?/) do |match|</code> </li> - <li class="never" data-hits="" data-linenumber="132"> + <li class="never" data-hits="" data-linenumber="136"> <code class="ruby"> case</code> </li> - <li class="never" data-hits="" data-linenumber="133"> + <li class="never" data-hits="" data-linenumber="137"> <code class="ruby"> when match[1].nil? # e.g. /(normal)/</code> </li> - <li class="covered" data-hits="38" data-linenumber="134"> - <span class="hits">38</span> + <li class="covered" data-hits="42" data-linenumber="138"> + <span class="hits">42</span> <code class="ruby"> group_id = @num_groups.to_s</code> </li> - <li class="never" data-hits="" data-linenumber="135"> + <li class="never" data-hits="" data-linenumber="139"> <code class="ruby"> when match[2] == &#39;:&#39; # e.g. /(?:nocapture)/</code> </li> - <li class="covered" data-hits="1" data-linenumber="136"> + <li class="covered" data-hits="1" data-linenumber="140"> <span class="hits">1</span> <code class="ruby"> @current_position += 2</code> </li> - <li class="covered" data-hits="1" data-linenumber="137"> + <li class="covered" data-hits="1" data-linenumber="141"> <span class="hits">1</span> <code class="ruby"> group_id = nil</code> </li> - <li class="never" data-hits="" data-linenumber="138"> + <li class="never" data-hits="" data-linenumber="142"> <code class="ruby"> when %w(! =).include?(match[2]) # e.g. /(?=lookahead)/, /(?!neglookahead)/</code> </li> - <li class="covered" data-hits="2" data-linenumber="139"> + <li class="covered" data-hits="2" data-linenumber="143"> <span class="hits">2</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Lookaheads are not regular; cannot generate examples&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="140"> + <li class="never" data-hits="" data-linenumber="144"> <code class="ruby"> when %w(! =).include?(match[3]) # e.g. /(?&lt;=lookbehind)/, /(?&lt;!neglookbehind)/</code> </li> - <li class="covered" data-hits="2" data-linenumber="141"> + <li class="covered" data-hits="2" data-linenumber="145"> <span class="hits">2</span> <code class="ruby"> raise IllegalSyntaxError, &quot;Lookbehinds are not regular; cannot generate examples&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="142"> + <li class="never" data-hits="" data-linenumber="146"> <code class="ruby"> else # e.g. /(?&lt;name&gt;namedgroup)/</code> </li> - <li class="covered" data-hits="3" data-linenumber="143"> + <li class="covered" data-hits="3" data-linenumber="147"> <span class="hits">3</span> <code class="ruby"> @current_position += (match[3].length + 3)</code> </li> - <li class="covered" data-hits="3" data-linenumber="144"> + <li class="covered" data-hits="3" data-linenumber="148"> <span class="hits">3</span> <code class="ruby"> group_id = match[3]</code> </li> - <li class="covered" data-hits="46" data-linenumber="145"> - <span class="hits">46</span> + <li class="covered" data-hits="50" data-linenumber="149"> + <span class="hits">50</span> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="146"> + <li class="never" data-hits="" data-linenumber="150"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="42" data-linenumber="147"> - <span class="hits">42</span> + <li class="covered" data-hits="46" data-linenumber="151"> + <span class="hits">46</span> <code class="ruby"> groups = parse</code> </li> - <li class="covered" data-hits="41" data-linenumber="148"> - <span class="hits">41</span> + <li class="covered" data-hits="45" data-linenumber="152"> + <span class="hits">45</span> <code class="ruby"> MultiGroup.new(groups, group_id)</code> </li> - <li class="never" data-hits="" data-linenumber="149"> + <li class="never" data-hits="" data-linenumber="153"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="150"> + <li class="never" data-hits="" data-linenumber="154"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="151"> + <li class="covered" data-hits="1" data-linenumber="155"> <span class="hits">1</span> <code class="ruby"> def parse_multi_end_group</code> </li> - <li class="covered" data-hits="41" data-linenumber="152"> - <span class="hits">41</span> + <li class="covered" data-hits="45" data-linenumber="156"> + <span class="hits">45</span> <code class="ruby"> MultiGroupEnd.new</code> </li> - <li class="never" data-hits="" data-linenumber="153"> + <li class="never" data-hits="" data-linenumber="157"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="154"> + <li class="never" data-hits="" data-linenumber="158"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="155"> + <li class="covered" data-hits="1" data-linenumber="159"> <span class="hits">1</span> <code class="ruby"> def parse_char_group</code> </li> - <li class="covered" data-hits="27" data-linenumber="156"> + <li class="covered" data-hits="27" data-linenumber="160"> <span class="hits">27</span> <code class="ruby"> if rest_of_string =~ /\A\[\[:[^:]+:\]\]/</code> </li> - <li class="covered" data-hits="1" data-linenumber="157"> + <li class="covered" data-hits="1" data-linenumber="161"> <span class="hits">1</span> <code class="ruby"> raise UnsupportedSyntaxError, &quot;POSIX bracket expressions are not yet implemented&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="158"> + <li class="never" data-hits="" data-linenumber="162"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="26" data-linenumber="159"> + <li class="covered" data-hits="26" data-linenumber="163"> <span class="hits">26</span> <code class="ruby"> chars = []</code> </li> - <li class="covered" data-hits="26" data-linenumber="160"> + <li class="covered" data-hits="26" data-linenumber="164"> <span class="hits">26</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="26" data-linenumber="161"> + <li class="covered" data-hits="26" data-linenumber="165"> <span class="hits">26</span> <code class="ruby"> if regexp_string[@current_position] == &#39;]&#39;</code> </li> - <li class="never" data-hits="" data-linenumber="162"> + <li class="never" data-hits="" data-linenumber="166"> <code class="ruby"> # Beware of the sneaky edge case:</code> </li> - <li class="never" data-hits="" data-linenumber="163"> + <li class="never" data-hits="" data-linenumber="167"> <code class="ruby"> # /[]]/ (match &quot;]&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="164"> + <li class="covered" data-hits="1" data-linenumber="168"> <span class="hits">1</span> <code class="ruby"> chars &lt;&lt; &#39;]&#39;</code> </li> - <li class="covered" data-hits="1" data-linenumber="165"> + <li class="covered" data-hits="1" data-linenumber="169"> <span class="hits">1</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="never" data-hits="" data-linenumber="166"> + <li class="never" data-hits="" data-linenumber="170"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="167"> + <li class="never" data-hits="" data-linenumber="171"> <code class="ruby"> until regexp_string[@current_position] == &#39;]&#39; \</code> </li> - <li class="covered" data-hits="26" data-linenumber="168"> + <li class="covered" data-hits="26" data-linenumber="172"> <span class="hits">26</span> <code class="ruby"> &amp;&amp; !regexp_string[0..@current_position-1].match(/[^\\](\\{2})*\\\z/)</code> </li> - <li class="never" data-hits="" data-linenumber="169"> + <li class="never" data-hits="" data-linenumber="173"> <code class="ruby"> # Beware of having an ODD number of &quot;\&quot; before the &quot;]&quot;, e.g.</code> </li> - <li class="never" data-hits="" data-linenumber="170"> + <li class="never" data-hits="" data-linenumber="174"> <code class="ruby"> # /[\]]/ (match &quot;]&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="171"> + <li class="never" data-hits="" data-linenumber="175"> <code class="ruby"> # /[\\]/ (match &quot;\&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="172"> + <li class="never" data-hits="" data-linenumber="176"> <code class="ruby"> # /[\\\]]/ (match &quot;\&quot; or &quot;]&quot;)</code> </li> - <li class="covered" data-hits="105" data-linenumber="173"> - <span class="hits">105</span> + <li class="covered" data-hits="102" data-linenumber="177"> + <span class="hits">102</span> <code class="ruby"> chars &lt;&lt; regexp_string[@current_position]</code> </li> - <li class="covered" data-hits="105" data-linenumber="174"> - <span class="hits">105</span> + <li class="covered" data-hits="102" data-linenumber="178"> + <span class="hits">102</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="never" data-hits="" data-linenumber="175"> + <li class="never" data-hits="" data-linenumber="179"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="26" data-linenumber="176"> + <li class="covered" data-hits="26" data-linenumber="180"> <span class="hits">26</span> <code class="ruby"> CharGroup.new(chars)</code> </li> - <li class="never" data-hits="" data-linenumber="177"> + <li class="never" data-hits="" data-linenumber="181"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="178"> + <li class="never" data-hits="" data-linenumber="182"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="179"> + <li class="covered" data-hits="1" data-linenumber="183"> <span class="hits">1</span> <code class="ruby"> def parse_dot_group</code> </li> - <li class="covered" data-hits="4" data-linenumber="180"> + <li class="covered" data-hits="4" data-linenumber="184"> <span class="hits">4</span> <code class="ruby"> DotGroup.new</code> </li> - <li class="never" data-hits="" data-linenumber="181"> + <li class="never" data-hits="" data-linenumber="185"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="182"> + <li class="never" data-hits="" data-linenumber="186"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="183"> + <li class="covered" data-hits="1" data-linenumber="187"> <span class="hits">1</span> <code class="ruby"> def parse_or_group(left_repeaters)</code> </li> - <li class="covered" data-hits="9" data-linenumber="184"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="188"> + <span class="hits">11</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="9" data-linenumber="185"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="189"> + <span class="hits">11</span> <code class="ruby"> right_repeaters = parse</code> </li> - <li class="covered" data-hits="9" data-linenumber="186"> - <span class="hits">9</span> + <li class="covered" data-hits="11" data-linenumber="190"> + <span class="hits">11</span> <code class="ruby"> OrGroup.new(left_repeaters, right_repeaters)</code> </li> - <li class="never" data-hits="" data-linenumber="187"> + <li class="never" data-hits="" data-linenumber="191"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="188"> + <li class="never" data-hits="" data-linenumber="192"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="189"> + <li class="never" data-hits="" data-linenumber="193"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="190"> + <li class="covered" data-hits="1" data-linenumber="194"> <span class="hits">1</span> <code class="ruby"> def parse_single_char_group(char)</code> </li> - <li class="covered" data-hits="280" data-linenumber="191"> - <span class="hits">280</span> + <li class="covered" data-hits="287" data-linenumber="195"> + <span class="hits">287</span> <code class="ruby"> SingleCharGroup.new(char)</code> </li> - <li class="never" data-hits="" data-linenumber="192"> + <li class="never" data-hits="" data-linenumber="196"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="193"> + <li class="never" data-hits="" data-linenumber="197"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="194"> + <li class="covered" data-hits="1" data-linenumber="198"> <span class="hits">1</span> <code class="ruby"> def parse_backreference_group(match)</code> </li> - <li class="covered" data-hits="20" data-linenumber="195"> - <span class="hits">20</span> + <li class="covered" data-hits="22" data-linenumber="199"> + <span class="hits">22</span> <code class="ruby"> BackReferenceGroup.new(match)</code> </li> - <li class="never" data-hits="" data-linenumber="196"> + <li class="never" data-hits="" data-linenumber="200"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="197"> + <li class="never" data-hits="" data-linenumber="201"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="198"> + <li class="covered" data-hits="1" data-linenumber="202"> <span class="hits">1</span> <code class="ruby"> def parse_control_character(char)</code> </li> - <li class="covered" data-hits="8" data-linenumber="199"> + <li class="covered" data-hits="8" data-linenumber="203"> <span class="hits">8</span> <code class="ruby"> (char.ord % 32).chr # Black magic!</code> </li> - <li class="never" data-hits="" data-linenumber="200"> + <li class="never" data-hits="" data-linenumber="204"> <code class="ruby"> # eval &quot;?\\C-#{char.chr}&quot; # Doesn&#39;t work for e.g. char = &quot;?&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="201"> + <li class="never" data-hits="" data-linenumber="205"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="202"> + <li class="never" data-hits="" data-linenumber="206"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="203"> + <li class="covered" data-hits="1" data-linenumber="207"> <span class="hits">1</span> <code class="ruby"> def parse_escape_sequence(match)</code> </li> - <li class="covered" data-hits="3" data-linenumber="204"> + <li class="covered" data-hits="3" data-linenumber="208"> <span class="hits">3</span> <code class="ruby"> eval &quot;?\\x#{match}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="205"> + <li class="never" data-hits="" data-linenumber="209"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="206"> + <li class="never" data-hits="" data-linenumber="210"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="207"> + <li class="covered" data-hits="1" data-linenumber="211"> <span class="hits">1</span> <code class="ruby"> def parse_unicode_sequence(match)</code> </li> - <li class="covered" data-hits="3" data-linenumber="208"> + <li class="covered" data-hits="3" data-linenumber="212"> <span class="hits">3</span> <code class="ruby"> eval &quot;?\\u{#{match}}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="209"> + <li class="never" data-hits="" data-linenumber="213"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="210"> + <li class="never" data-hits="" data-linenumber="214"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="211"> + <li class="covered" data-hits="1" data-linenumber="215"> <span class="hits">1</span> <code class="ruby"> def parse_star_repeater(group)</code> </li> - <li class="covered" data-hits="6" data-linenumber="212"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="216"> + <span class="hits">5</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="6" data-linenumber="213"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="217"> + <span class="hits">5</span> <code class="ruby"> StarRepeater.new(group)</code> </li> - <li class="never" data-hits="" data-linenumber="214"> + <li class="never" data-hits="" data-linenumber="218"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="215"> + <li class="never" data-hits="" data-linenumber="219"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="216"> + <li class="covered" data-hits="1" data-linenumber="220"> <span class="hits">1</span> <code class="ruby"> def parse_plus_repeater(group)</code> </li> - <li class="covered" data-hits="5" data-linenumber="217"> - <span class="hits">5</span> + <li class="covered" data-hits="7" data-linenumber="221"> + <span class="hits">7</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="5" data-linenumber="218"> - <span class="hits">5</span> + <li class="covered" data-hits="7" data-linenumber="222"> + <span class="hits">7</span> <code class="ruby"> PlusRepeater.new(group)</code> </li> - <li class="never" data-hits="" data-linenumber="219"> + <li class="never" data-hits="" data-linenumber="223"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="220"> + <li class="never" data-hits="" data-linenumber="224"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="221"> + <li class="covered" data-hits="1" data-linenumber="225"> <span class="hits">1</span> <code class="ruby"> def parse_question_mark_repeater(group)</code> </li> - <li class="covered" data-hits="11" data-linenumber="222"> - <span class="hits">11</span> + <li class="covered" data-hits="13" data-linenumber="226"> + <span class="hits">13</span> <code class="ruby"> @current_position += 1</code> </li> - <li class="covered" data-hits="11" data-linenumber="223"> - <span class="hits">11</span> + <li class="covered" data-hits="13" data-linenumber="227"> + <span class="hits">13</span> <code class="ruby"> QuestionMarkRepeater.new(group)</code> </li> - <li class="never" data-hits="" data-linenumber="224"> + <li class="never" data-hits="" data-linenumber="228"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="225"> + <li class="never" data-hits="" data-linenumber="229"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="226"> + <li class="covered" data-hits="1" data-linenumber="230"> <span class="hits">1</span> <code class="ruby"> def parse_range_repeater(group)</code> </li> - <li class="covered" data-hits="6" data-linenumber="227"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="231"> + <span class="hits">9</span> <code class="ruby"> match = rest_of_string.match(/\A\{(\d+)?(,)?(\d+)?\}/)</code> </li> - <li class="covered" data-hits="6" data-linenumber="228"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="232"> + <span class="hits">9</span> <code class="ruby"> @current_position += match[0].size</code> </li> - <li class="covered" data-hits="6" data-linenumber="229"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="233"> + <span class="hits">9</span> <code class="ruby"> min = match[1].to_i if match[1]</code> </li> - <li class="covered" data-hits="6" data-linenumber="230"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="234"> + <span class="hits">9</span> <code class="ruby"> has_comma = !match[2].nil?</code> </li> - <li class="covered" data-hits="6" data-linenumber="231"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="235"> + <span class="hits">9</span> <code class="ruby"> max = match[3].to_i if match[3]</code> </li> - <li class="covered" data-hits="6" data-linenumber="232"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="236"> + <span class="hits">9</span> <code class="ruby"> RangeRepeater.new(group, min, has_comma, max)</code> </li> - <li class="never" data-hits="" data-linenumber="233"> + <li class="never" data-hits="" data-linenumber="237"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="234"> + <li class="never" data-hits="" data-linenumber="238"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="235"> + <li class="covered" data-hits="1" data-linenumber="239"> <span class="hits">1</span> <code class="ruby"> def parse_one_time_repeater(group)</code> </li> - <li class="covered" data-hits="357" data-linenumber="236"> - <span class="hits">357</span> + <li class="covered" data-hits="365" data-linenumber="240"> + <span class="hits">365</span> <code class="ruby"> OneTimeRepeater.new(group)</code> </li> - <li class="never" data-hits="" data-linenumber="237"> + <li class="never" data-hits="" data-linenumber="241"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="238"> + <li class="never" data-hits="" data-linenumber="242"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="239"> + <li class="covered" data-hits="1" data-linenumber="243"> <span class="hits">1</span> <code class="ruby"> def rest_of_string</code> </li> - <li class="covered" data-hits="306" data-linenumber="240"> - <span class="hits">306</span> + <li class="covered" data-hits="317" data-linenumber="244"> + <span class="hits">317</span> <code class="ruby"> regexp_string[@current_position..-1]</code> </li> - <li class="never" data-hits="" data-linenumber="241"> + <li class="never" data-hits="" data-linenumber="245"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="242"> + <li class="never" data-hits="" data-linenumber="246"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="243"> + <li class="never" data-hits="" data-linenumber="247"> <code class="ruby">end</code> </li> - <li class="never" data-hits="" data-linenumber="244"> + <li class="never" data-hits="" data-linenumber="248"> <code class="ruby"></code> </li> @@ -3397,98 +3523,62 @@ </li> <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby"> def examples</code> + <code class="ruby"> def examples(options={})</code> </li> - <li class="never" data-hits="" data-linenumber="4"> + <li class="covered" data-hits="112" data-linenumber="4"> + <span class="hits">112</span> - - <code class="ruby"># partial_examples =</code> + <code class="ruby"> full_examples = RegexpExamples.map_results(</code> </li> <li class="never" data-hits="" data-linenumber="5"> - <code class="ruby"># RegexpExamples::Parser.new(source)</code> + <code class="ruby"> RegexpExamples::Parser.new(source, options).parse</code> </li> <li class="never" data-hits="" data-linenumber="6"> - <code class="ruby"># .parse</code> - </li> - - <li class="never" data-hits="" data-linenumber="7"> - - - <code class="ruby"># .map {|repeater| repeater.result}</code> - </li> - - <li class="never" data-hits="" data-linenumber="8"> - - - <code class="ruby"># full_examples = RegexpExamples::permutations_of_strings(partial_examples)</code> - </li> - - <li class="never" data-hits="" data-linenumber="9"> - - - <code class="ruby"></code> - </li> - - <li class="covered" data-hits="106" data-linenumber="10"> - <span class="hits">106</span> - - <code class="ruby"> full_examples = RegexpExamples::map_results(</code> - </li> - - <li class="never" data-hits="" data-linenumber="11"> - - - <code class="ruby"> RegexpExamples::Parser.new(source).parse</code> - </li> - - <li class="never" data-hits="" data-linenumber="12"> - - <code class="ruby"> )</code> </li> - <li class="covered" data-hits="89" data-linenumber="13"> - <span class="hits">89</span> + <li class="covered" data-hits="95" data-linenumber="7"> + <span class="hits">95</span> <code class="ruby"> RegexpExamples::BackReferenceReplacer.new.substitute_backreferences(full_examples)</code> </li> - <li class="never" data-hits="" data-linenumber="14"> + <li class="never" data-hits="" data-linenumber="8"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="15"> + <li class="never" data-hits="" data-linenumber="9"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="16"> + <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> <code class="ruby"> include Examples</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="11"> <code class="ruby">end</code> </li> - <li class="never" data-hits="" data-linenumber="18"> + <li class="never" data-hits="" data-linenumber="12"> <code class="ruby"></code> </li> @@ -3499,12 +3589,12 @@ <div class="source_table" id="0688fc9c3b085e9a6444775c61767c9c5742fb69"> <div class="header"> <h3>lib/regexp-examples/repeaters.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>46</b> relevant lines. - <span class="green"><b>46</b> lines covered</span> and + <b>47</b> relevant lines. + <span class="green"><b>47</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -3532,12 +3622,12 @@ <span class="hits">1</span> <code class="ruby"> def initialize(group)</code> </li> - <li class="covered" data-hits="394" data-linenumber="5"> - <span class="hits">394</span> + <li class="covered" data-hits="410" data-linenumber="5"> + <span class="hits">410</span> <code class="ruby"> @group = group</code> </li> <li class="never" data-hits="" data-linenumber="6"> @@ -3556,461 +3646,485 @@ <span class="hits">1</span> <code class="ruby"> def result(min_repeats, max_repeats)</code> </li> - <li class="covered" data-hits="353" data-linenumber="9"> - <span class="hits">353</span> + <li class="covered" data-hits="369" data-linenumber="9"> + <span class="hits">369</span> - <code class="ruby"> group_results = @group.result[0 .. MaxGroupResults-1]</code> + <code class="ruby"> group_results = @group.result[0 .. RegexpExamples.MaxGroupResults-1]</code> </li> - <li class="covered" data-hits="353" data-linenumber="10"> - <span class="hits">353</span> + <li class="covered" data-hits="369" data-linenumber="10"> + <span class="hits">369</span> <code class="ruby"> results = []</code> </li> - <li class="covered" data-hits="353" data-linenumber="11"> - <span class="hits">353</span> + <li class="covered" data-hits="369" data-linenumber="11"> + <span class="hits">369</span> <code class="ruby"> min_repeats.upto(max_repeats) do |repeats|</code> </li> - <li class="covered" data-hits="391" data-linenumber="12"> - <span class="hits">391</span> + <li class="covered" data-hits="414" data-linenumber="12"> + <span class="hits">414</span> - <code class="ruby"> group_results.each do |group_result|</code> + <code class="ruby"> if repeats.zero?</code> </li> - <li class="covered" data-hits="499" data-linenumber="13"> - <span class="hits">499</span> + <li class="covered" data-hits="19" data-linenumber="13"> + <span class="hits">19</span> - <code class="ruby"> results &lt;&lt; group_result * repeats</code> + <code class="ruby"> results &lt;&lt; [ GroupResult.new(&#39;&#39;) ]</code> </li> <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> end</code> + <code class="ruby"> else</code> </li> <li class="never" data-hits="" data-linenumber="15"> + <code class="ruby"> results &lt;&lt; RegexpExamples.permutations_of_strings(</code> + </li> + + <li class="never" data-hits="" data-linenumber="16"> + + + <code class="ruby"> [group_results] * repeats</code> + </li> + + <li class="covered" data-hits="395" data-linenumber="17"> + <span class="hits">395</span> + + <code class="ruby"> )</code> + </li> + + <li class="never" data-hits="" data-linenumber="18"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="19"> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="353" data-linenumber="16"> - <span class="hits">353</span> + <li class="covered" data-hits="369" data-linenumber="20"> + <span class="hits">369</span> - <code class="ruby"> results.uniq</code> + <code class="ruby"> results.flatten.uniq</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="21"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="18"> + <li class="never" data-hits="" data-linenumber="22"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="19"> + <li class="never" data-hits="" data-linenumber="23"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="20"> + <li class="covered" data-hits="1" data-linenumber="24"> <span class="hits">1</span> <code class="ruby"> class OneTimeRepeater &lt; BaseRepeater</code> </li> - <li class="covered" data-hits="1" data-linenumber="21"> + <li class="covered" data-hits="1" data-linenumber="25"> <span class="hits">1</span> <code class="ruby"> def initialize(group)</code> </li> - <li class="covered" data-hits="366" data-linenumber="22"> - <span class="hits">366</span> + <li class="covered" data-hits="376" data-linenumber="26"> + <span class="hits">376</span> <code class="ruby"> super</code> </li> - <li class="never" data-hits="" data-linenumber="23"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="24"> + <li class="never" data-hits="" data-linenumber="28"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="25"> + <li class="covered" data-hits="1" data-linenumber="29"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="325" data-linenumber="26"> - <span class="hits">325</span> + <li class="covered" data-hits="335" data-linenumber="30"> + <span class="hits">335</span> <code class="ruby"> super(1, 1)</code> </li> - <li class="never" data-hits="" data-linenumber="27"> + <li class="never" data-hits="" data-linenumber="31"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="28"> + <li class="never" data-hits="" data-linenumber="32"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="29"> + <li class="never" data-hits="" data-linenumber="33"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="30"> + <li class="covered" data-hits="1" data-linenumber="34"> <span class="hits">1</span> <code class="ruby"> class StarRepeater &lt; BaseRepeater</code> </li> - <li class="covered" data-hits="1" data-linenumber="31"> + <li class="covered" data-hits="1" data-linenumber="35"> <span class="hits">1</span> <code class="ruby"> def initialize(group)</code> </li> - <li class="covered" data-hits="6" data-linenumber="32"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="36"> + <span class="hits">5</span> <code class="ruby"> super</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="34"> + <li class="never" data-hits="" data-linenumber="38"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="35"> + <li class="covered" data-hits="1" data-linenumber="39"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="6" data-linenumber="36"> - <span class="hits">6</span> + <li class="covered" data-hits="5" data-linenumber="40"> + <span class="hits">5</span> - <code class="ruby"> super(0, MaxRepeaterVariance)</code> + <code class="ruby"> super(0, RegexpExamples.MaxRepeaterVariance)</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="41"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="38"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="39"> + <li class="never" data-hits="" data-linenumber="43"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="40"> + <li class="covered" data-hits="1" data-linenumber="44"> <span class="hits">1</span> <code class="ruby"> class PlusRepeater &lt; BaseRepeater</code> </li> - <li class="covered" data-hits="1" data-linenumber="41"> + <li class="covered" data-hits="1" data-linenumber="45"> <span class="hits">1</span> <code class="ruby"> def initialize(group)</code> </li> - <li class="covered" data-hits="5" data-linenumber="42"> - <span class="hits">5</span> + <li class="covered" data-hits="7" data-linenumber="46"> + <span class="hits">7</span> <code class="ruby"> super</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="48"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="45"> + <li class="covered" data-hits="1" data-linenumber="49"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="5" data-linenumber="46"> - <span class="hits">5</span> + <li class="covered" data-hits="7" data-linenumber="50"> + <span class="hits">7</span> - <code class="ruby"> super(1, MaxRepeaterVariance + 1)</code> + <code class="ruby"> super(1, RegexpExamples.MaxRepeaterVariance + 1)</code> </li> - <li class="never" data-hits="" data-linenumber="47"> + <li class="never" data-hits="" data-linenumber="51"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="52"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="50"> + <li class="covered" data-hits="1" data-linenumber="54"> <span class="hits">1</span> <code class="ruby"> class QuestionMarkRepeater &lt; BaseRepeater</code> </li> - <li class="covered" data-hits="1" data-linenumber="51"> + <li class="covered" data-hits="1" data-linenumber="55"> <span class="hits">1</span> <code class="ruby"> def initialize(group)</code> </li> - <li class="covered" data-hits="11" data-linenumber="52"> - <span class="hits">11</span> + <li class="covered" data-hits="13" data-linenumber="56"> + <span class="hits">13</span> <code class="ruby"> super</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="57"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="54"> + <li class="never" data-hits="" data-linenumber="58"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="55"> + <li class="covered" data-hits="1" data-linenumber="59"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="11" data-linenumber="56"> - <span class="hits">11</span> + <li class="covered" data-hits="13" data-linenumber="60"> + <span class="hits">13</span> <code class="ruby"> super(0, 1)</code> </li> - <li class="never" data-hits="" data-linenumber="57"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="62"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="never" data-hits="" data-linenumber="63"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="60"> + <li class="covered" data-hits="1" data-linenumber="64"> <span class="hits">1</span> <code class="ruby"> class RangeRepeater &lt; BaseRepeater</code> </li> - <li class="covered" data-hits="1" data-linenumber="61"> + <li class="covered" data-hits="1" data-linenumber="65"> <span class="hits">1</span> <code class="ruby"> def initialize(group, min, has_comma, max)</code> </li> - <li class="covered" data-hits="6" data-linenumber="62"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="66"> + <span class="hits">9</span> <code class="ruby"> super(group)</code> </li> - <li class="covered" data-hits="6" data-linenumber="63"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="67"> + <span class="hits">9</span> <code class="ruby"> @min = min || 0</code> </li> - <li class="covered" data-hits="6" data-linenumber="64"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="68"> + <span class="hits">9</span> <code class="ruby"> if max</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="69"> <code class="ruby"> # Prevent huge number of results in case of e.g. /.{1,100}/.examples</code> </li> - <li class="covered" data-hits="2" data-linenumber="66"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="70"> + <span class="hits">3</span> - <code class="ruby"> @max = smallest(max, @min + MaxRepeaterVariance)</code> + <code class="ruby"> @max = smallest(max, @min + RegexpExamples.MaxRepeaterVariance)</code> </li> - <li class="covered" data-hits="4" data-linenumber="67"> - <span class="hits">4</span> + <li class="covered" data-hits="6" data-linenumber="71"> + <span class="hits">6</span> <code class="ruby"> elsif has_comma</code> </li> - <li class="covered" data-hits="1" data-linenumber="68"> + <li class="covered" data-hits="1" data-linenumber="72"> <span class="hits">1</span> - <code class="ruby"> @max = @min + MaxRepeaterVariance</code> + <code class="ruby"> @max = @min + RegexpExamples.MaxRepeaterVariance</code> </li> - <li class="never" data-hits="" data-linenumber="69"> + <li class="never" data-hits="" data-linenumber="73"> <code class="ruby"> else</code> </li> - <li class="covered" data-hits="3" data-linenumber="70"> - <span class="hits">3</span> + <li class="covered" data-hits="5" data-linenumber="74"> + <span class="hits">5</span> <code class="ruby"> @max = @min</code> </li> - <li class="never" data-hits="" data-linenumber="71"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="72"> + <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="73"> + <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="74"> + <li class="covered" data-hits="1" data-linenumber="78"> <span class="hits">1</span> <code class="ruby"> def result</code> </li> - <li class="covered" data-hits="6" data-linenumber="75"> - <span class="hits">6</span> + <li class="covered" data-hits="9" data-linenumber="79"> + <span class="hits">9</span> <code class="ruby"> super(@min, @max)</code> </li> - <li class="never" data-hits="" data-linenumber="76"> + <li class="never" data-hits="" data-linenumber="80"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="81"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="78"> + <li class="covered" data-hits="1" data-linenumber="82"> <span class="hits">1</span> <code class="ruby"> private</code> </li> - <li class="covered" data-hits="1" data-linenumber="79"> + <li class="covered" data-hits="1" data-linenumber="83"> <span class="hits">1</span> <code class="ruby"> def smallest(x, y)</code> </li> - <li class="covered" data-hits="2" data-linenumber="80"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="84"> + <span class="hits">3</span> <code class="ruby"> (x &lt; y) ? x : y</code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="never" data-hits="" data-linenumber="85"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="82"> + <li class="never" data-hits="" data-linenumber="86"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="83"> + <li class="never" data-hits="" data-linenumber="87"> <code class="ruby">end</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="88"> <code class="ruby"></code> </li> @@ -4021,12 +4135,12 @@ <div class="source_table" id="953f94f8f5f8bad7e1fa800f942a74b781f8fa1c"> <div class="header"> <h3>spec/regexp-examples_spec.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>50</b> relevant lines. - <span class="green"><b>50</b> lines covered</span> and + <b>61</b> relevant lines. + <span class="green"><b>61</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -4042,36 +4156,36 @@ <span class="hits">1</span> <code class="ruby"> def self.examples_exist_and_match(*regexps)</code> </li> - <li class="covered" data-hits="12" data-linenumber="3"> - <span class="hits">12</span> + <li class="covered" data-hits="11" data-linenumber="3"> + <span class="hits">11</span> <code class="ruby"> regexps.each do |regexp|</code> </li> - <li class="covered" data-hits="79" data-linenumber="4"> - <span class="hits">79</span> + <li class="covered" data-hits="80" data-linenumber="4"> + <span class="hits">80</span> <code class="ruby"> it do</code> </li> - <li class="covered" data-hits="79" data-linenumber="5"> - <span class="hits">79</span> + <li class="covered" data-hits="80" data-linenumber="5"> + <span class="hits">80</span> <code class="ruby"> regexp_examples = regexp.examples</code> </li> - <li class="covered" data-hits="79" data-linenumber="6"> - <span class="hits">79</span> + <li class="covered" data-hits="80" data-linenumber="6"> + <span class="hits">80</span> <code class="ruby"> expect(regexp_examples).not_to be_empty</code> </li> - <li class="covered" data-hits="262" data-linenumber="7"> - <span class="hits">262</span> + <li class="covered" data-hits="263" data-linenumber="7"> + <span class="hits">263</span> <code class="ruby"> regexp_examples.each { |example| expect(example).to match(/\A(?:#{regexp.source})\z/) }</code> </li> <li class="never" data-hits="" data-linenumber="8"> @@ -4228,18 +4342,18 @@ <span class="hits">1</span> <code class="ruby"> regexps.each do |regexp|</code> </li> - <li class="covered" data-hits="10" data-linenumber="34"> - <span class="hits">10</span> + <li class="covered" data-hits="9" data-linenumber="34"> + <span class="hits">9</span> <code class="ruby"> it do</code> </li> - <li class="covered" data-hits="10" data-linenumber="35"> - <span class="hits">10</span> + <li class="covered" data-hits="9" data-linenumber="35"> + <span class="hits">9</span> <code class="ruby"> expect(regexp.examples).to be_empty</code> </li> <li class="never" data-hits="" data-linenumber="36"> @@ -4735,649 +4849,769 @@ </li> <li class="never" data-hits="" data-linenumber="118"> - <code class="ruby"> /(a?(b?(c?(d?(e?)))))/</code> + <code class="ruby"> /(a?(b?(c?(d?(e?)))))/,</code> </li> <li class="never" data-hits="" data-linenumber="119"> - <code class="ruby"> )</code> + <code class="ruby"> /(a)? \1/,</code> </li> <li class="never" data-hits="" data-linenumber="120"> - <code class="ruby"> end</code> + <code class="ruby"> /(a|(b)) \2/</code> </li> <li class="never" data-hits="" data-linenumber="121"> + <code class="ruby"> )</code> + </li> + + <li class="never" data-hits="" data-linenumber="122"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="123"> + + <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="122"> + <li class="covered" data-hits="1" data-linenumber="124"> <span class="hits">1</span> <code class="ruby"> context &quot;for complex patterns&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="123"> + <li class="never" data-hits="" data-linenumber="125"> <code class="ruby"> # Longer combinations of the above</code> </li> - <li class="covered" data-hits="1" data-linenumber="124"> + <li class="covered" data-hits="1" data-linenumber="126"> <span class="hits">1</span> <code class="ruby"> examples_exist_and_match(</code> </li> - <li class="never" data-hits="" data-linenumber="125"> + <li class="never" data-hits="" data-linenumber="127"> <code class="ruby"> /https?:\/\/(www\.)github\.com/,</code> </li> - <li class="never" data-hits="" data-linenumber="126"> + <li class="never" data-hits="" data-linenumber="128"> <code class="ruby"> /(I(N(C(E(P(T(I(O(N)))))))))*/,</code> </li> - <li class="never" data-hits="" data-linenumber="127"> + <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"> /[\w]{1}/,</code> </li> - <li class="never" data-hits="" data-linenumber="128"> + <li class="never" data-hits="" data-linenumber="130"> <code class="ruby"> /((a?b*c+)) \1/,</code> </li> - <li class="never" data-hits="" data-linenumber="129"> + <li class="never" data-hits="" data-linenumber="131"> <code class="ruby"> /((a?b*c+)?) \1/,</code> </li> - <li class="never" data-hits="" data-linenumber="130"> + <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"> /a|b|c|d/,</code> </li> - <li class="never" data-hits="" data-linenumber="131"> + <li class="never" data-hits="" data-linenumber="133"> <code class="ruby"> /a+|b*|c?/,</code> </li> - <li class="never" data-hits="" data-linenumber="132"> + <li class="never" data-hits="" data-linenumber="134"> <code class="ruby"> /one|two|three/</code> </li> - <li class="never" data-hits="" data-linenumber="133"> + <li class="never" data-hits="" data-linenumber="135"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="134"> + <li class="never" data-hits="" data-linenumber="136"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="135"> + <li class="never" data-hits="" data-linenumber="137"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="136"> + <li class="covered" data-hits="1" data-linenumber="138"> <span class="hits">1</span> <code class="ruby"> context &quot;for illegal syntax&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="137"> + <li class="covered" data-hits="1" data-linenumber="139"> <span class="hits">1</span> <code class="ruby"> examples_raise_illegal_syntax_error(</code> </li> - <li class="never" data-hits="" data-linenumber="138"> + <li class="never" data-hits="" data-linenumber="140"> <code class="ruby"> /(?=lookahead)/,</code> </li> - <li class="never" data-hits="" data-linenumber="139"> + <li class="never" data-hits="" data-linenumber="141"> <code class="ruby"> /(?!neglookahead)/,</code> </li> - <li class="never" data-hits="" data-linenumber="140"> + <li class="never" data-hits="" data-linenumber="142"> <code class="ruby"> /(?&lt;=lookbehind)/,</code> </li> - <li class="never" data-hits="" data-linenumber="141"> + <li class="never" data-hits="" data-linenumber="143"> <code class="ruby"> /(?&lt;!neglookbehind)/,</code> </li> - <li class="never" data-hits="" data-linenumber="142"> + <li class="never" data-hits="" data-linenumber="144"> <code class="ruby"> /\bword-boundary/,</code> </li> - <li class="never" data-hits="" data-linenumber="143"> + <li class="never" data-hits="" data-linenumber="145"> <code class="ruby"> /no\Bn-word-boundary/,</code> </li> - <li class="never" data-hits="" data-linenumber="144"> + <li class="never" data-hits="" data-linenumber="146"> <code class="ruby"> /\Glast-match/,</code> </li> - <li class="never" data-hits="" data-linenumber="145"> + <li class="never" data-hits="" data-linenumber="147"> <code class="ruby"> /start-of\A-string/,</code> </li> - <li class="never" data-hits="" data-linenumber="146"> + <li class="never" data-hits="" data-linenumber="148"> <code class="ruby"> /start-of^-line/,</code> </li> - <li class="never" data-hits="" data-linenumber="147"> + <li class="never" data-hits="" data-linenumber="149"> <code class="ruby"> /end-of\Z-string/,</code> </li> - <li class="never" data-hits="" data-linenumber="148"> + <li class="never" data-hits="" data-linenumber="150"> <code class="ruby"> /end-of\z-string/,</code> </li> - <li class="never" data-hits="" data-linenumber="149"> + <li class="never" data-hits="" data-linenumber="151"> <code class="ruby"> /end-of$-line/</code> </li> - <li class="never" data-hits="" data-linenumber="150"> + <li class="never" data-hits="" data-linenumber="152"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="151"> + <li class="never" data-hits="" data-linenumber="153"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="152"> + <li class="never" data-hits="" data-linenumber="154"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="153"> + <li class="covered" data-hits="1" data-linenumber="155"> <span class="hits">1</span> <code class="ruby"> context &quot;ignore start/end anchors if at start/end&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="154"> + <li class="covered" data-hits="1" data-linenumber="156"> <span class="hits">1</span> <code class="ruby"> examples_exist_and_match(</code> </li> - <li class="never" data-hits="" data-linenumber="155"> + <li class="never" data-hits="" data-linenumber="157"> <code class="ruby"> /\Astart/,</code> </li> - <li class="never" data-hits="" data-linenumber="156"> + <li class="never" data-hits="" data-linenumber="158"> <code class="ruby"> /^start/,</code> </li> - <li class="never" data-hits="" data-linenumber="157"> + <li class="never" data-hits="" data-linenumber="159"> <code class="ruby"> /end$/,</code> </li> - <li class="never" data-hits="" data-linenumber="158"> + <li class="never" data-hits="" data-linenumber="160"> <code class="ruby"> /end\z/,</code> </li> - <li class="never" data-hits="" data-linenumber="159"> + <li class="never" data-hits="" data-linenumber="161"> <code class="ruby"> /end\Z/</code> </li> - <li class="never" data-hits="" data-linenumber="160"> + <li class="never" data-hits="" data-linenumber="162"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="161"> + <li class="never" data-hits="" data-linenumber="163"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="162"> + <li class="never" data-hits="" data-linenumber="164"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="163"> + <li class="covered" data-hits="1" data-linenumber="165"> <span class="hits">1</span> <code class="ruby"> context &quot;for unsupported syntax&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="164"> + <li class="covered" data-hits="1" data-linenumber="166"> <span class="hits">1</span> <code class="ruby"> examples_raise_unsupported_syntax_error(</code> </li> - <li class="never" data-hits="" data-linenumber="165"> + <li class="never" data-hits="" data-linenumber="167"> <code class="ruby"> /\p{L}/,</code> </li> - <li class="never" data-hits="" data-linenumber="166"> + <li class="never" data-hits="" data-linenumber="168"> <code class="ruby"> /\p{Arabic}/,</code> </li> - <li class="never" data-hits="" data-linenumber="167"> + <li class="never" data-hits="" data-linenumber="169"> <code class="ruby"> /\p{^Ll}/,</code> </li> - <li class="never" data-hits="" data-linenumber="168"> + <li class="never" data-hits="" data-linenumber="170"> <code class="ruby"> /(?&lt;name&gt; ... \g&lt;name&gt;*)/,</code> </li> - <li class="never" data-hits="" data-linenumber="169"> + <li class="never" data-hits="" data-linenumber="171"> <code class="ruby"> /[[:space:]]/</code> </li> - <li class="never" data-hits="" data-linenumber="170"> + <li class="never" data-hits="" data-linenumber="172"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="171"> + <li class="never" data-hits="" data-linenumber="173"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="172"> + <li class="never" data-hits="" data-linenumber="174"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="173"> + <li class="covered" data-hits="1" data-linenumber="175"> <span class="hits">1</span> <code class="ruby"> context &quot;for control characters&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="174"> + <li class="covered" data-hits="1" data-linenumber="176"> <span class="hits">1</span> <code class="ruby"> examples_exist_and_match(</code> </li> - <li class="never" data-hits="" data-linenumber="175"> + <li class="never" data-hits="" data-linenumber="177"> <code class="ruby"> /\ca/,</code> </li> - <li class="never" data-hits="" data-linenumber="176"> + <li class="never" data-hits="" data-linenumber="178"> <code class="ruby"> /\cZ/,</code> </li> - <li class="never" data-hits="" data-linenumber="177"> + <li class="never" data-hits="" data-linenumber="179"> <code class="ruby"> /\c9/,</code> </li> - <li class="never" data-hits="" data-linenumber="178"> + <li class="never" data-hits="" data-linenumber="180"> <code class="ruby"> /\c[/,</code> </li> - <li class="never" data-hits="" data-linenumber="179"> + <li class="never" data-hits="" data-linenumber="181"> <code class="ruby"> /\c#/,</code> </li> - <li class="never" data-hits="" data-linenumber="180"> + <li class="never" data-hits="" data-linenumber="182"> <code class="ruby"> /\c?/,</code> </li> - <li class="never" data-hits="" data-linenumber="181"> + <li class="never" data-hits="" data-linenumber="183"> <code class="ruby"> /\C-a/,</code> </li> - <li class="never" data-hits="" data-linenumber="182"> + <li class="never" data-hits="" data-linenumber="184"> <code class="ruby"> /\C-&amp;/</code> </li> - <li class="never" data-hits="" data-linenumber="183"> + <li class="never" data-hits="" data-linenumber="185"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="184"> + <li class="never" data-hits="" data-linenumber="186"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="185"> + <li class="never" data-hits="" data-linenumber="187"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="186"> + <li class="covered" data-hits="1" data-linenumber="188"> <span class="hits">1</span> <code class="ruby"> context &quot;for escape sequences&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="187"> + <li class="covered" data-hits="1" data-linenumber="189"> <span class="hits">1</span> <code class="ruby"> examples_exist_and_match(</code> </li> - <li class="never" data-hits="" data-linenumber="188"> + <li class="never" data-hits="" data-linenumber="190"> <code class="ruby"> /\x42/,</code> </li> - <li class="never" data-hits="" data-linenumber="189"> + <li class="never" data-hits="" data-linenumber="191"> <code class="ruby"> /\x1D/,</code> </li> - <li class="never" data-hits="" data-linenumber="190"> + <li class="never" data-hits="" data-linenumber="192"> <code class="ruby"> /\x3word/,</code> </li> - <li class="never" data-hits="" data-linenumber="191"> + <li class="never" data-hits="" data-linenumber="193"> <code class="ruby"> /#{&quot;\x80&quot;.force_encoding(&quot;ASCII-8BIT&quot;)}/</code> </li> - <li class="never" data-hits="" data-linenumber="192"> + <li class="never" data-hits="" data-linenumber="194"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="193"> + <li class="never" data-hits="" data-linenumber="195"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="194"> + <li class="never" data-hits="" data-linenumber="196"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="195"> + <li class="covered" data-hits="1" data-linenumber="197"> <span class="hits">1</span> <code class="ruby"> context &quot;for unicode sequences&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="196"> + <li class="covered" data-hits="1" data-linenumber="198"> <span class="hits">1</span> <code class="ruby"> examples_exist_and_match(</code> </li> - <li class="never" data-hits="" data-linenumber="197"> + <li class="never" data-hits="" data-linenumber="199"> <code class="ruby"> /\u6829/,</code> </li> - <li class="never" data-hits="" data-linenumber="198"> + <li class="never" data-hits="" data-linenumber="200"> <code class="ruby"> /\uabcd/,</code> </li> - <li class="never" data-hits="" data-linenumber="199"> + <li class="never" data-hits="" data-linenumber="201"> <code class="ruby"> /\u{42}word/</code> </li> - <li class="never" data-hits="" data-linenumber="200"> + <li class="never" data-hits="" data-linenumber="202"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="201"> + <li class="never" data-hits="" data-linenumber="203"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="202"> + <li class="never" data-hits="" data-linenumber="204"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="203"> + <li class="covered" data-hits="1" data-linenumber="205"> <span class="hits">1</span> <code class="ruby"> context &quot;for empty character sets&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="204"> + <li class="covered" data-hits="1" data-linenumber="206"> <span class="hits">1</span> <code class="ruby"> examples_are_empty(</code> </li> - <li class="never" data-hits="" data-linenumber="205"> + <li class="never" data-hits="" data-linenumber="207"> <code class="ruby"> /[^\d\D]/,</code> </li> - <li class="never" data-hits="" data-linenumber="206"> + <li class="never" data-hits="" data-linenumber="208"> <code class="ruby"> /[^\w\W]/,</code> </li> - <li class="never" data-hits="" data-linenumber="207"> + <li class="never" data-hits="" data-linenumber="209"> <code class="ruby"> /[^\s\S]/,</code> </li> - <li class="never" data-hits="" data-linenumber="208"> + <li class="never" data-hits="" data-linenumber="210"> <code class="ruby"> /[^\h\H]/,</code> </li> - <li class="never" data-hits="" data-linenumber="209"> + <li class="never" data-hits="" data-linenumber="211"> <code class="ruby"> /[^\D0-9]/,</code> </li> - <li class="never" data-hits="" data-linenumber="210"> + <li class="never" data-hits="" data-linenumber="212"> <code class="ruby"> /[^\Wa-zA-Z0-9_]/,</code> </li> - <li class="never" data-hits="" data-linenumber="211"> + <li class="never" data-hits="" data-linenumber="213"> - <code class="ruby"> /[^\d\D]*/,</code> - </li> - - <li class="never" data-hits="" data-linenumber="212"> - - <code class="ruby"> /[^\d\D]+/,</code> </li> - <li class="never" data-hits="" data-linenumber="213"> + <li class="never" data-hits="" data-linenumber="214"> <code class="ruby"> /[^\d\D]{2}/,</code> </li> - <li class="never" data-hits="" data-linenumber="214"> + <li class="never" data-hits="" data-linenumber="215"> <code class="ruby"> /[^\d\D]word/</code> </li> - <li class="never" data-hits="" data-linenumber="215"> + <li class="never" data-hits="" data-linenumber="216"> <code class="ruby"> )</code> </li> - <li class="never" data-hits="" data-linenumber="216"> + <li class="never" data-hits="" data-linenumber="217"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="217"> + <li class="never" data-hits="" data-linenumber="218"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="218"> + <li class="covered" data-hits="1" data-linenumber="219"> <span class="hits">1</span> - <code class="ruby"> context &#39;failing&#39; do</code> + <code class="ruby"> context &quot;exact examples match&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="219"> + <li class="never" data-hits="" data-linenumber="220"> + + + <code class="ruby"> # More rigorous tests to assert that ALL examples are being listed</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="221"> <span class="hits">1</span> - <code class="ruby"> examples_exist_and_match(</code> + <code class="ruby"> context &quot;default options&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="220"> + <li class="covered" data-hits="2" data-linenumber="222"> + <span class="hits">2</span> + <code class="ruby"> it { expect(/[ab]{2}/.examples).to eq [&quot;aa&quot;, &quot;ab&quot;, &quot;ba&quot;, &quot;bb&quot;] }</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="223"> + <span class="hits">2</span> - <code class="ruby"> /ab|cd/</code> + <code class="ruby"> it { expect(/(a|b){2}/.examples).to eq [&quot;aa&quot;, &quot;ab&quot;, &quot;ba&quot;, &quot;bb&quot;] }</code> </li> - <li class="never" data-hits="" data-linenumber="221"> + <li class="covered" data-hits="2" data-linenumber="224"> + <span class="hits">2</span> + <code class="ruby"> it { expect(/a+|b?/.examples).to eq [&quot;a&quot;, &quot;aa&quot;, &quot;aaa&quot;, &quot;&quot;, &quot;b&quot;] }</code> + </li> + + <li class="never" data-hits="" data-linenumber="225"> - <code class="ruby"> )</code> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="222"> + <li class="covered" data-hits="1" data-linenumber="226"> + <span class="hits">1</span> + <code class="ruby"> context &quot;max_repeater_variance option&quot; do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="227"> + <span class="hits">1</span> + <code class="ruby"> it do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="228"> + <span class="hits">1</span> + + <code class="ruby"> expect(/a+/.examples(max_repeater_variance: 5))</code> + </li> + + <li class="never" data-hits="" data-linenumber="229"> + + + <code class="ruby"> .to eq %w(a aa aaa aaaa aaaaa aaaaaa)</code> + </li> + + <li class="never" data-hits="" data-linenumber="230"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="231"> + <span class="hits">1</span> + + <code class="ruby"> it do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="232"> + <span class="hits">1</span> + + <code class="ruby"> expect(/a{4,8}/.examples(max_repeater_variance: 0))</code> + </li> + + <li class="never" data-hits="" data-linenumber="233"> + + + <code class="ruby"> .to eq %w(aaaa)</code> + </li> + + <li class="never" data-hits="" data-linenumber="234"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="235"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="236"> + <span class="hits">1</span> + + <code class="ruby"> context &quot;max_group_results option&quot; do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="237"> + <span class="hits">1</span> + + <code class="ruby"> it do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="238"> + <span class="hits">1</span> + + <code class="ruby"> expect(/\d/.examples(max_group_results: 10))</code> + </li> + + <li class="never" data-hits="" data-linenumber="239"> + + + <code class="ruby"> .to eq %w(0 1 2 3 4 5 6 7 8 9)</code> + </li> + + <li class="never" data-hits="" data-linenumber="240"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="241"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="242"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="223"> + <li class="never" data-hits="" data-linenumber="243"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="224"> + <li class="never" data-hits="" data-linenumber="244"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="225"> + <li class="never" data-hits="" data-linenumber="245"> <code class="ruby">end</code> </li>