diff-lcs 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/Contributing.md +2 -0
 - data/History.md +86 -55
 - data/License.md +6 -4
 - data/Rakefile +36 -27
 - data/bin/htmldiff +4 -4
 - data/lib/diff/lcs/array.rb +1 -1
 - data/lib/diff/lcs/backports.rb +2 -2
 - data/lib/diff/lcs/block.rb +4 -4
 - data/lib/diff/lcs/callbacks.rb +9 -7
 - data/lib/diff/lcs/change.rb +19 -19
 - data/lib/diff/lcs/htmldiff.rb +24 -16
 - data/lib/diff/lcs/hunk.rb +35 -30
 - data/lib/diff/lcs/internals.rb +17 -17
 - data/lib/diff/lcs/ldiff.rb +37 -35
 - data/lib/diff/lcs.rb +57 -55
 - data/lib/diff-lcs.rb +1 -1
 - data/spec/change_spec.rb +50 -50
 - data/spec/diff_spec.rb +14 -14
 - data/spec/hunk_spec.rb +19 -19
 - data/spec/issues_spec.rb +48 -42
 - data/spec/lcs_spec.rb +11 -11
 - data/spec/ldiff_spec.rb +13 -11
 - data/spec/patch_spec.rb +84 -84
 - data/spec/sdiff_spec.rb +111 -109
 - data/spec/spec_helper.rb +76 -74
 - data/spec/traverse_balanced_spec.rb +191 -189
 - data/spec/traverse_sequences_spec.rb +31 -31
 - metadata +28 -21
 
| 
         @@ -1,310 +1,312 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require  
     | 
| 
      
 3 
     | 
    
         
            +
            require "spec_helper"
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            describe  
     | 
| 
      
 5 
     | 
    
         
            +
            describe "Diff::LCS.traverse_balanced" do
         
     | 
| 
       6 
6 
     | 
    
         
             
              include Diff::LCS::SpecHelper::Matchers
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              shared_examples  
     | 
| 
       9 
     | 
    
         
            -
                it  
     | 
| 
      
 8 
     | 
    
         
            +
              shared_examples "with a #change callback" do |s1, s2, result|
         
     | 
| 
      
 9 
     | 
    
         
            +
                it "traverses s1 -> s2 correctly" do
         
     | 
| 
       10 
10 
     | 
    
         
             
                  traversal = balanced_traversal(s1, s2, :balanced_callback)
         
     | 
| 
       11 
11 
     | 
    
         
             
                  expect(traversal.result).to eq(result)
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                it  
     | 
| 
      
 14 
     | 
    
         
            +
                it "traverses s2 -> s1 correctly" do
         
     | 
| 
       15 
15 
     | 
    
         
             
                  traversal = balanced_traversal(s2, s1, :balanced_callback)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  expect(traversal.result).to eq(balanced_reverse(result))
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              shared_examples  
     | 
| 
       21 
     | 
    
         
            -
                it  
     | 
| 
      
 20 
     | 
    
         
            +
              shared_examples "without a #change callback" do |s1, s2, result|
         
     | 
| 
      
 21 
     | 
    
         
            +
                it "traverses s1 -> s2 correctly" do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  traversal = balanced_traversal(s1, s2, :balanced_callback_no_change)
         
     | 
| 
       23 
23 
     | 
    
         
             
                  expect(traversal.result).to eq(map_to_no_change(result))
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                it  
     | 
| 
      
 26 
     | 
    
         
            +
                it "traverses s2 -> s1 correctly" do
         
     | 
| 
       27 
27 
     | 
    
         
             
                  traversal = balanced_traversal(s2, s1, :balanced_callback_no_change)
         
     | 
| 
       28 
28 
     | 
    
         
             
                  expect(traversal.result).to eq(map_to_no_change(balanced_reverse(result)))
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
              describe "identical string sequences ('abc')" do
         
     | 
| 
       33 
     | 
    
         
            -
                s1 = s2 =  
     | 
| 
      
 33 
     | 
    
         
            +
                s1 = s2 = "abc"
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                result = [
         
     | 
| 
       36 
     | 
    
         
            -
                  [ 
     | 
| 
       37 
     | 
    
         
            -
                  [ 
     | 
| 
       38 
     | 
    
         
            -
                  [ 
     | 
| 
      
 36 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 37 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 38 
     | 
    
         
            +
                  ["=", 2, 2]
         
     | 
| 
       39 
39 
     | 
    
         
             
                ]
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       42 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 41 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 42 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       43 
43 
     | 
    
         
             
              end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
              describe  
     | 
| 
       46 
     | 
    
         
            -
                s1 = s2 = %w 
     | 
| 
      
 45 
     | 
    
         
            +
              describe "identical array sequences %w(a b c)" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                s1 = s2 = %w[a b c]
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                result = [
         
     | 
| 
       49 
     | 
    
         
            -
                  [ 
     | 
| 
       50 
     | 
    
         
            -
                  [ 
     | 
| 
       51 
     | 
    
         
            -
                  [ 
     | 
| 
      
 49 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 50 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 51 
     | 
    
         
            +
                  ["=", 2, 2]
         
     | 
| 
       52 
52 
     | 
    
         
             
                ]
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       55 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 54 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 55 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       56 
56 
     | 
    
         
             
              end
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
              describe  
     | 
| 
       59 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       60 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 58 
     | 
    
         
            +
              describe "sequences %w(a b c) & %w(a x c)" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                s1 = %w[a b c]
         
     | 
| 
      
 60 
     | 
    
         
            +
                s2 = %w[a x c]
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
                result = [
         
     | 
| 
       63 
     | 
    
         
            -
                  [ 
     | 
| 
       64 
     | 
    
         
            -
                  [ 
     | 
| 
       65 
     | 
    
         
            -
                  [ 
     | 
| 
      
 63 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 64 
     | 
    
         
            +
                  ["!", 1, 1],
         
     | 
| 
      
 65 
     | 
    
         
            +
                  ["=", 2, 2]
         
     | 
| 
       66 
66 
     | 
    
         
             
                ]
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       69 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 68 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 69 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       70 
70 
     | 
    
         
             
              end
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
              describe  
     | 
| 
       73 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       74 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 72 
     | 
    
         
            +
              describe "sequences %w(a x y c) & %w(a v w c)" do
         
     | 
| 
      
 73 
     | 
    
         
            +
                s1 = %w[a x y c]
         
     | 
| 
      
 74 
     | 
    
         
            +
                s2 = %w[a v w c]
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
                result = [
         
     | 
| 
       77 
     | 
    
         
            -
                  [ 
     | 
| 
       78 
     | 
    
         
            -
                  [ 
     | 
| 
       79 
     | 
    
         
            -
                  [ 
     | 
| 
       80 
     | 
    
         
            -
                  [ 
     | 
| 
      
 77 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 78 
     | 
    
         
            +
                  ["!", 1, 1],
         
     | 
| 
      
 79 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 80 
     | 
    
         
            +
                  ["=", 3, 3]
         
     | 
| 
       81 
81 
     | 
    
         
             
                ]
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       84 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 83 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 84 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       85 
85 
     | 
    
         
             
              end
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
              describe  
     | 
| 
       88 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       89 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 87 
     | 
    
         
            +
              describe "sequences %w(x y c) & %w(v w c)" do
         
     | 
| 
      
 88 
     | 
    
         
            +
                s1 = %w[x y c]
         
     | 
| 
      
 89 
     | 
    
         
            +
                s2 = %w[v w c]
         
     | 
| 
       90 
90 
     | 
    
         
             
                result = [
         
     | 
| 
       91 
     | 
    
         
            -
                  [ 
     | 
| 
       92 
     | 
    
         
            -
                  [ 
     | 
| 
       93 
     | 
    
         
            -
                  [ 
     | 
| 
      
 91 
     | 
    
         
            +
                  ["!", 0, 0],
         
     | 
| 
      
 92 
     | 
    
         
            +
                  ["!", 1, 1],
         
     | 
| 
      
 93 
     | 
    
         
            +
                  ["=", 2, 2]
         
     | 
| 
       94 
94 
     | 
    
         
             
                ]
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       97 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 96 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 97 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       98 
98 
     | 
    
         
             
              end
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
              describe  
     | 
| 
       101 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       102 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 100 
     | 
    
         
            +
              describe "sequences %w(a x y z) & %w(b v w)" do
         
     | 
| 
      
 101 
     | 
    
         
            +
                s1 = %w[a x y z]
         
     | 
| 
      
 102 
     | 
    
         
            +
                s2 = %w[b v w]
         
     | 
| 
       103 
103 
     | 
    
         
             
                result = [
         
     | 
| 
       104 
     | 
    
         
            -
                  [ 
     | 
| 
       105 
     | 
    
         
            -
                  [ 
     | 
| 
       106 
     | 
    
         
            -
                  [ 
     | 
| 
       107 
     | 
    
         
            -
                  [ 
     | 
| 
      
 104 
     | 
    
         
            +
                  ["!", 0, 0],
         
     | 
| 
      
 105 
     | 
    
         
            +
                  ["!", 1, 1],
         
     | 
| 
      
 106 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 107 
     | 
    
         
            +
                  ["<", 3, 3]
         
     | 
| 
       108 
108 
     | 
    
         
             
                ]
         
     | 
| 
       109 
109 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       111 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 110 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 111 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       112 
112 
     | 
    
         
             
              end
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
     | 
    
         
            -
              describe  
     | 
| 
       115 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       116 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 114 
     | 
    
         
            +
              describe "sequences %w(a z) & %w(a)" do
         
     | 
| 
      
 115 
     | 
    
         
            +
                s1 = %w[a z]
         
     | 
| 
      
 116 
     | 
    
         
            +
                s2 = %w[a]
         
     | 
| 
       117 
117 
     | 
    
         
             
                result = [
         
     | 
| 
       118 
     | 
    
         
            -
                  [ 
     | 
| 
       119 
     | 
    
         
            -
                  [ 
     | 
| 
      
 118 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 119 
     | 
    
         
            +
                  ["<", 1, 1]
         
     | 
| 
       120 
120 
     | 
    
         
             
                ]
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       123 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 122 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 123 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       124 
124 
     | 
    
         
             
              end
         
     | 
| 
       125 
125 
     | 
    
         | 
| 
       126 
     | 
    
         
            -
              describe  
     | 
| 
       127 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       128 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 126 
     | 
    
         
            +
              describe "sequences %w(z a) & %w(a)" do
         
     | 
| 
      
 127 
     | 
    
         
            +
                s1 = %w[z a]
         
     | 
| 
      
 128 
     | 
    
         
            +
                s2 = %w[a]
         
     | 
| 
       129 
129 
     | 
    
         
             
                result = [
         
     | 
| 
       130 
     | 
    
         
            -
                  [ 
     | 
| 
       131 
     | 
    
         
            -
                  [ 
     | 
| 
      
 130 
     | 
    
         
            +
                  ["<", 0, 0],
         
     | 
| 
      
 131 
     | 
    
         
            +
                  ["=", 1, 0]
         
     | 
| 
       132 
132 
     | 
    
         
             
                ]
         
     | 
| 
       133 
133 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       135 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 134 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 135 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       136 
136 
     | 
    
         
             
              end
         
     | 
| 
       137 
137 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
              describe  
     | 
| 
       139 
     | 
    
         
            -
                s1 = %w 
     | 
| 
       140 
     | 
    
         
            -
                s2 = %w 
     | 
| 
      
 138 
     | 
    
         
            +
              describe "sequences %w(a b c) & %w(x y z)" do
         
     | 
| 
      
 139 
     | 
    
         
            +
                s1 = %w[a b c]
         
     | 
| 
      
 140 
     | 
    
         
            +
                s2 = %w[x y z]
         
     | 
| 
       141 
141 
     | 
    
         
             
                result = [
         
     | 
| 
       142 
     | 
    
         
            -
                  [ 
     | 
| 
       143 
     | 
    
         
            -
                  [ 
     | 
| 
       144 
     | 
    
         
            -
                  [ 
     | 
| 
      
 142 
     | 
    
         
            +
                  ["!", 0, 0],
         
     | 
| 
      
 143 
     | 
    
         
            +
                  ["!", 1, 1],
         
     | 
| 
      
 144 
     | 
    
         
            +
                  ["!", 2, 2]
         
     | 
| 
       145 
145 
     | 
    
         
             
                ]
         
     | 
| 
       146 
146 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       148 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 147 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 148 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       149 
149 
     | 
    
         
             
              end
         
     | 
| 
       150 
150 
     | 
    
         | 
| 
       151 
     | 
    
         
            -
              describe  
     | 
| 
       152 
     | 
    
         
            -
                s1 = %w 
     | 
| 
      
 151 
     | 
    
         
            +
              describe "sequences %w(abcd efgh ijkl mnoopqrstuvwxyz) & []" do
         
     | 
| 
      
 152 
     | 
    
         
            +
                s1 = %w[abcd efgh ijkl mnopqrstuvwxyz]
         
     | 
| 
       153 
153 
     | 
    
         
             
                s2 = []
         
     | 
| 
       154 
154 
     | 
    
         
             
                result = [
         
     | 
| 
       155 
     | 
    
         
            -
                  [ 
     | 
| 
       156 
     | 
    
         
            -
                  [ 
     | 
| 
       157 
     | 
    
         
            -
                  [ 
     | 
| 
       158 
     | 
    
         
            -
                  [ 
     | 
| 
      
 155 
     | 
    
         
            +
                  ["<", 0, 0],
         
     | 
| 
      
 156 
     | 
    
         
            +
                  ["<", 1, 0],
         
     | 
| 
      
 157 
     | 
    
         
            +
                  ["<", 2, 0],
         
     | 
| 
      
 158 
     | 
    
         
            +
                  ["<", 3, 0]
         
     | 
| 
       159 
159 
     | 
    
         
             
                ]
         
     | 
| 
       160 
160 
     | 
    
         | 
| 
       161 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       162 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 161 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 162 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       163 
163 
     | 
    
         
             
              end
         
     | 
| 
       164 
164 
     | 
    
         | 
| 
       165 
     | 
    
         
            -
              describe  
     | 
| 
       166 
     | 
    
         
            -
                s1 =  
     | 
| 
       167 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 165 
     | 
    
         
            +
              describe "strings %q(a b c) & %q(a x c)" do
         
     | 
| 
      
 166 
     | 
    
         
            +
                s1 = "a b c"
         
     | 
| 
      
 167 
     | 
    
         
            +
                s2 = "a x c"
         
     | 
| 
       168 
168 
     | 
    
         | 
| 
       169 
169 
     | 
    
         
             
                result = [
         
     | 
| 
       170 
     | 
    
         
            -
                  [ 
     | 
| 
       171 
     | 
    
         
            -
                  [ 
     | 
| 
       172 
     | 
    
         
            -
                  [ 
     | 
| 
       173 
     | 
    
         
            -
                  [ 
     | 
| 
       174 
     | 
    
         
            -
                  [ 
     | 
| 
      
 170 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 171 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 172 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 173 
     | 
    
         
            +
                  ["=", 3, 3],
         
     | 
| 
      
 174 
     | 
    
         
            +
                  ["=", 4, 4]
         
     | 
| 
       175 
175 
     | 
    
         
             
                ]
         
     | 
| 
       176 
176 
     | 
    
         | 
| 
       177 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       178 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 177 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 178 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       179 
179 
     | 
    
         
             
              end
         
     | 
| 
       180 
180 
     | 
    
         | 
| 
       181 
     | 
    
         
            -
              describe  
     | 
| 
       182 
     | 
    
         
            -
                s1 =  
     | 
| 
       183 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 181 
     | 
    
         
            +
              describe "strings %q(a x y c) & %q(a v w c)" do
         
     | 
| 
      
 182 
     | 
    
         
            +
                s1 = "a x y c"
         
     | 
| 
      
 183 
     | 
    
         
            +
                s2 = "a v w c"
         
     | 
| 
       184 
184 
     | 
    
         | 
| 
       185 
185 
     | 
    
         
             
                result = [
         
     | 
| 
       186 
     | 
    
         
            -
                  [ 
     | 
| 
       187 
     | 
    
         
            -
                  [ 
     | 
| 
       188 
     | 
    
         
            -
                  [ 
     | 
| 
       189 
     | 
    
         
            -
                  [ 
     | 
| 
       190 
     | 
    
         
            -
                  [ 
     | 
| 
       191 
     | 
    
         
            -
                  [ 
     | 
| 
       192 
     | 
    
         
            -
                  [ 
     | 
| 
      
 186 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 187 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 188 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 189 
     | 
    
         
            +
                  ["=", 3, 3],
         
     | 
| 
      
 190 
     | 
    
         
            +
                  ["!", 4, 4],
         
     | 
| 
      
 191 
     | 
    
         
            +
                  ["=", 5, 5],
         
     | 
| 
      
 192 
     | 
    
         
            +
                  ["=", 6, 6]
         
     | 
| 
       193 
193 
     | 
    
         
             
                ]
         
     | 
| 
       194 
194 
     | 
    
         | 
| 
       195 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       196 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 195 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 196 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       197 
197 
     | 
    
         
             
              end
         
     | 
| 
       198 
198 
     | 
    
         | 
| 
       199 
     | 
    
         
            -
              describe  
     | 
| 
       200 
     | 
    
         
            -
                s1 =  
     | 
| 
       201 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 199 
     | 
    
         
            +
              describe "strings %q(x y c) & %q(v w c)" do
         
     | 
| 
      
 200 
     | 
    
         
            +
                s1 = "x y c"
         
     | 
| 
      
 201 
     | 
    
         
            +
                s2 = "v w c"
         
     | 
| 
       202 
202 
     | 
    
         
             
                result = [
         
     | 
| 
       203 
     | 
    
         
            -
                  [ 
     | 
| 
       204 
     | 
    
         
            -
                  [ 
     | 
| 
       205 
     | 
    
         
            -
                  [ 
     | 
| 
       206 
     | 
    
         
            -
                  [ 
     | 
| 
       207 
     | 
    
         
            -
                  [ 
     | 
| 
      
 203 
     | 
    
         
            +
                  ["!", 0, 0],
         
     | 
| 
      
 204 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 205 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 206 
     | 
    
         
            +
                  ["=", 3, 3],
         
     | 
| 
      
 207 
     | 
    
         
            +
                  ["=", 4, 4]
         
     | 
| 
       208 
208 
     | 
    
         
             
                ]
         
     | 
| 
       209 
209 
     | 
    
         | 
| 
       210 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       211 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 210 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 211 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       212 
212 
     | 
    
         
             
              end
         
     | 
| 
       213 
213 
     | 
    
         | 
| 
       214 
     | 
    
         
            -
              describe  
     | 
| 
       215 
     | 
    
         
            -
                s1 =  
     | 
| 
       216 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 214 
     | 
    
         
            +
              describe "strings %q(a x y z) & %q(b v w)" do
         
     | 
| 
      
 215 
     | 
    
         
            +
                s1 = "a x y z"
         
     | 
| 
      
 216 
     | 
    
         
            +
                s2 = "b v w"
         
     | 
| 
       217 
217 
     | 
    
         
             
                result = [
         
     | 
| 
       218 
     | 
    
         
            -
                  [ 
     | 
| 
       219 
     | 
    
         
            -
                  [ 
     | 
| 
       220 
     | 
    
         
            -
                  [ 
     | 
| 
       221 
     | 
    
         
            -
                  [ 
     | 
| 
       222 
     | 
    
         
            -
                  [ 
     | 
| 
       223 
     | 
    
         
            -
                  [ 
     | 
| 
       224 
     | 
    
         
            -
                  [ 
     | 
| 
      
 218 
     | 
    
         
            +
                  ["!", 0, 0],
         
     | 
| 
      
 219 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 220 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 221 
     | 
    
         
            +
                  ["=", 3, 3],
         
     | 
| 
      
 222 
     | 
    
         
            +
                  ["!", 4, 4],
         
     | 
| 
      
 223 
     | 
    
         
            +
                  ["<", 5, 5],
         
     | 
| 
      
 224 
     | 
    
         
            +
                  ["<", 6, 5]
         
     | 
| 
       225 
225 
     | 
    
         
             
                ]
         
     | 
| 
       226 
226 
     | 
    
         | 
| 
       227 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       228 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 227 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 228 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       229 
229 
     | 
    
         
             
              end
         
     | 
| 
       230 
230 
     | 
    
         | 
| 
       231 
     | 
    
         
            -
              describe  
     | 
| 
       232 
     | 
    
         
            -
                s1 =  
     | 
| 
       233 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 231 
     | 
    
         
            +
              describe "strings %q(a z) & %q(a)" do
         
     | 
| 
      
 232 
     | 
    
         
            +
                s1 = "a z"
         
     | 
| 
      
 233 
     | 
    
         
            +
                s2 = "a"
         
     | 
| 
       234 
234 
     | 
    
         
             
                result = [
         
     | 
| 
       235 
     | 
    
         
            -
                  [ 
     | 
| 
       236 
     | 
    
         
            -
                  [ 
     | 
| 
       237 
     | 
    
         
            -
                  [ 
     | 
| 
      
 235 
     | 
    
         
            +
                  ["=", 0, 0],
         
     | 
| 
      
 236 
     | 
    
         
            +
                  ["<", 1, 1],
         
     | 
| 
      
 237 
     | 
    
         
            +
                  ["<", 2, 1]
         
     | 
| 
       238 
238 
     | 
    
         
             
                ]
         
     | 
| 
       239 
239 
     | 
    
         | 
| 
       240 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       241 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 240 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 241 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       242 
242 
     | 
    
         
             
              end
         
     | 
| 
       243 
243 
     | 
    
         | 
| 
       244 
     | 
    
         
            -
              describe  
     | 
| 
       245 
     | 
    
         
            -
                s1 =  
     | 
| 
       246 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 244 
     | 
    
         
            +
              describe "strings %q(z a) & %q(a)" do
         
     | 
| 
      
 245 
     | 
    
         
            +
                s1 = "z a"
         
     | 
| 
      
 246 
     | 
    
         
            +
                s2 = "a"
         
     | 
| 
       247 
247 
     | 
    
         
             
                result = [
         
     | 
| 
       248 
     | 
    
         
            -
                  [ 
     | 
| 
       249 
     | 
    
         
            -
                  [ 
     | 
| 
       250 
     | 
    
         
            -
                  [ 
     | 
| 
      
 248 
     | 
    
         
            +
                  ["<", 0, 0],
         
     | 
| 
      
 249 
     | 
    
         
            +
                  ["<", 1, 0],
         
     | 
| 
      
 250 
     | 
    
         
            +
                  ["=", 2, 0]
         
     | 
| 
       251 
251 
     | 
    
         
             
                ]
         
     | 
| 
       252 
252 
     | 
    
         | 
| 
       253 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       254 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 253 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 254 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       255 
255 
     | 
    
         
             
              end
         
     | 
| 
       256 
256 
     | 
    
         | 
| 
       257 
     | 
    
         
            -
              describe  
     | 
| 
       258 
     | 
    
         
            -
                s1 =  
     | 
| 
       259 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 257 
     | 
    
         
            +
              describe "strings %q(a b c) & %q(x y z)" do
         
     | 
| 
      
 258 
     | 
    
         
            +
                s1 = "a b c"
         
     | 
| 
      
 259 
     | 
    
         
            +
                s2 = "x y z"
         
     | 
| 
       260 
260 
     | 
    
         
             
                result = [
         
     | 
| 
       261 
     | 
    
         
            -
                  [ 
     | 
| 
       262 
     | 
    
         
            -
                  [ 
     | 
| 
       263 
     | 
    
         
            -
                  [ 
     | 
| 
       264 
     | 
    
         
            -
                  [ 
     | 
| 
       265 
     | 
    
         
            -
                  [ 
     | 
| 
      
 261 
     | 
    
         
            +
                  ["!", 0, 0],
         
     | 
| 
      
 262 
     | 
    
         
            +
                  ["=", 1, 1],
         
     | 
| 
      
 263 
     | 
    
         
            +
                  ["!", 2, 2],
         
     | 
| 
      
 264 
     | 
    
         
            +
                  ["=", 3, 3],
         
     | 
| 
      
 265 
     | 
    
         
            +
                  ["!", 4, 4]
         
     | 
| 
       266 
266 
     | 
    
         
             
                ]
         
     | 
| 
       267 
267 
     | 
    
         | 
| 
       268 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       269 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 268 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 269 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       270 
270 
     | 
    
         
             
              end
         
     | 
| 
       271 
271 
     | 
    
         | 
| 
       272 
     | 
    
         
            -
              describe  
     | 
| 
       273 
     | 
    
         
            -
                s1 =  
     | 
| 
       274 
     | 
    
         
            -
                s2 =  
     | 
| 
      
 272 
     | 
    
         
            +
              describe "strings %q(abcd efgh ijkl mnopqrstuvwxyz) & %q()" do
         
     | 
| 
      
 273 
     | 
    
         
            +
                s1 = "abcd efgh ijkl mnopqrstuvwxyz"
         
     | 
| 
      
 274 
     | 
    
         
            +
                s2 = ""
         
     | 
| 
      
 275 
     | 
    
         
            +
                # standard:disable Layout/ExtraSpacing
         
     | 
| 
       275 
276 
     | 
    
         
             
                result = [
         
     | 
| 
       276 
     | 
    
         
            -
                  [ 
     | 
| 
       277 
     | 
    
         
            -
                  [ 
     | 
| 
       278 
     | 
    
         
            -
                  [ 
     | 
| 
       279 
     | 
    
         
            -
                  [ 
     | 
| 
       280 
     | 
    
         
            -
                  [ 
     | 
| 
       281 
     | 
    
         
            -
                  [ 
     | 
| 
       282 
     | 
    
         
            -
                  [ 
     | 
| 
       283 
     | 
    
         
            -
                  [ 
     | 
| 
       284 
     | 
    
         
            -
                  [ 
     | 
| 
       285 
     | 
    
         
            -
                  [ 
     | 
| 
       286 
     | 
    
         
            -
                  [ 
     | 
| 
       287 
     | 
    
         
            -
                  [ 
     | 
| 
       288 
     | 
    
         
            -
                  [ 
     | 
| 
       289 
     | 
    
         
            -
                  [ 
     | 
| 
       290 
     | 
    
         
            -
                  [ 
     | 
| 
       291 
     | 
    
         
            -
                  [ 
     | 
| 
       292 
     | 
    
         
            -
                  [ 
     | 
| 
       293 
     | 
    
         
            -
                  [ 
     | 
| 
       294 
     | 
    
         
            -
                  [ 
     | 
| 
       295 
     | 
    
         
            -
                  [ 
     | 
| 
       296 
     | 
    
         
            -
                  [ 
     | 
| 
       297 
     | 
    
         
            -
                  [ 
     | 
| 
       298 
     | 
    
         
            -
                  [ 
     | 
| 
       299 
     | 
    
         
            -
                  [ 
     | 
| 
       300 
     | 
    
         
            -
                  [ 
     | 
| 
       301 
     | 
    
         
            -
                  [ 
     | 
| 
       302 
     | 
    
         
            -
                  [ 
     | 
| 
       303 
     | 
    
         
            -
                  [ 
     | 
| 
       304 
     | 
    
         
            -
                  [ 
     | 
| 
      
 277 
     | 
    
         
            +
                  ["<",  0, 0],
         
     | 
| 
      
 278 
     | 
    
         
            +
                  ["<",  1, 0],
         
     | 
| 
      
 279 
     | 
    
         
            +
                  ["<",  2, 0],
         
     | 
| 
      
 280 
     | 
    
         
            +
                  ["<",  3, 0],
         
     | 
| 
      
 281 
     | 
    
         
            +
                  ["<",  4, 0],
         
     | 
| 
      
 282 
     | 
    
         
            +
                  ["<",  5, 0],
         
     | 
| 
      
 283 
     | 
    
         
            +
                  ["<",  6, 0],
         
     | 
| 
      
 284 
     | 
    
         
            +
                  ["<",  7, 0],
         
     | 
| 
      
 285 
     | 
    
         
            +
                  ["<",  8, 0],
         
     | 
| 
      
 286 
     | 
    
         
            +
                  ["<",  9, 0],
         
     | 
| 
      
 287 
     | 
    
         
            +
                  ["<", 10, 0],
         
     | 
| 
      
 288 
     | 
    
         
            +
                  ["<", 11, 0],
         
     | 
| 
      
 289 
     | 
    
         
            +
                  ["<", 12, 0],
         
     | 
| 
      
 290 
     | 
    
         
            +
                  ["<", 13, 0],
         
     | 
| 
      
 291 
     | 
    
         
            +
                  ["<", 14, 0],
         
     | 
| 
      
 292 
     | 
    
         
            +
                  ["<", 15, 0],
         
     | 
| 
      
 293 
     | 
    
         
            +
                  ["<", 16, 0],
         
     | 
| 
      
 294 
     | 
    
         
            +
                  ["<", 17, 0],
         
     | 
| 
      
 295 
     | 
    
         
            +
                  ["<", 18, 0],
         
     | 
| 
      
 296 
     | 
    
         
            +
                  ["<", 19, 0],
         
     | 
| 
      
 297 
     | 
    
         
            +
                  ["<", 20, 0],
         
     | 
| 
      
 298 
     | 
    
         
            +
                  ["<", 21, 0],
         
     | 
| 
      
 299 
     | 
    
         
            +
                  ["<", 22, 0],
         
     | 
| 
      
 300 
     | 
    
         
            +
                  ["<", 23, 0],
         
     | 
| 
      
 301 
     | 
    
         
            +
                  ["<", 24, 0],
         
     | 
| 
      
 302 
     | 
    
         
            +
                  ["<", 25, 0],
         
     | 
| 
      
 303 
     | 
    
         
            +
                  ["<", 26, 0],
         
     | 
| 
      
 304 
     | 
    
         
            +
                  ["<", 27, 0],
         
     | 
| 
      
 305 
     | 
    
         
            +
                  ["<", 28, 0]
         
     | 
| 
       305 
306 
     | 
    
         
             
                ]
         
     | 
| 
      
 307 
     | 
    
         
            +
                # standard:enable Layout/ExtraSpacing
         
     | 
| 
       306 
308 
     | 
    
         | 
| 
       307 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
       308 
     | 
    
         
            -
                it_has_behavior  
     | 
| 
      
 309 
     | 
    
         
            +
                it_has_behavior "with a #change callback", s1, s2, result
         
     | 
| 
      
 310 
     | 
    
         
            +
                it_has_behavior "without a #change callback", s1, s2, result
         
     | 
| 
       309 
311 
     | 
    
         
             
              end
         
     | 
| 
       310 
312 
     | 
    
         
             
            end
         
     |