Sha256: aeea7c55930d2c4d8760065f450706be4c53c38fd6ca990aee0cb041623d9525

Contents?: true

Size: 956 Bytes

Versions: 96

Compression:

Stored size: 956 Bytes

Contents

# -*- ruby encoding: utf-8 -*-

require 'spec_helper'

describe "Diff::LCS.diff" do
  include Diff::LCS::SpecHelper::Matchers

  it "should correctly diff seq1 to seq2" do
    diff_s1_s2 = Diff::LCS.diff(seq1, seq2)
    change_diff(correct_forward_diff).should == diff_s1_s2
  end

  it "should correctly diff seq2 to seq1" do
    diff_s2_s1 = Diff::LCS.diff(seq2, seq1)
    change_diff(correct_backward_diff).should == diff_s2_s1
  end

  it "should correctly diff against an empty sequence" do
    diff = Diff::LCS.diff(word_sequence, [])
    correct_diff = [
      [ [ '-', 0, 'abcd'           ],
        [ '-', 1, 'efgh'           ],
        [ '-', 2, 'ijkl'           ],
        [ '-', 3, 'mnopqrstuvwxyz' ] ]
    ]

    change_diff(correct_diff).should == diff

    diff = Diff::LCS.diff([], word_sequence)
    correct_diff.each { |hunk| hunk.each { |change| change[0] = '+' } }
    change_diff(correct_diff).should == diff
  end
end

# vim: ft=ruby

Version data entries

96 entries across 89 versions & 16 rubygems

Version Path
classiccms-0.3.6 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.3.5 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.3.4 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.3.3 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.3.2 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.3.1 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.3.0 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/diff-lcs-1.1.3/spec/diff_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/diff-lcs-1.1.3/spec/diff_spec.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/diff-lcs-1.1.3/spec/diff_spec.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/diff-lcs-1.1.3/spec/diff_spec.rb
ftl-0.2.0 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classiccms-0.2.4.pre vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb
horseman-0.0.5 vendor/ruby/1.9.1/gems/diff-lcs-1.1.3/spec/diff_spec.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/diff-lcs-1.1.3/spec/diff_spec.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/diff-lcs-1.1.3/spec/diff_spec.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/diff-lcs-1.1.3/spec/diff_spec.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/diff-lcs-1.1.3/spec/diff_spec.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/diff-lcs-1.1.3/spec/diff_spec.rb
classicCMS-0.2.3 vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb