Sha256: 61e44cc469f5463f94a1a7a8cf631e31c87c9805e6f89a82c531186e8ae26e85

Contents?: true

Size: 792 Bytes

Versions: 6

Compression:

Stored size: 792 Bytes

Contents

require File.dirname(__FILE__) + '/helper'
require 'cgi'

class DiffTest < Test::Unit::TestCase
  context "Pretty Diff" do

    setup do
      @small_diff = PrettyDiff::Diff.new read_diff('first.diff')
      @big_diff   = PrettyDiff::Diff.new read_diff('second.diff')
    end

    should "generate correct amount of chunks for each diff" do
      assert_equal 2, @small_diff.send(:chunks).size
      assert_equal 4, @big_diff.send(:chunks).size
    end

    should "generate HTML representation without errors" do
      assert @small_diff.to_html
      assert @big_diff.to_html
    end

    should "escape HTML from the input string" do
      text = "<b>Funky HTML</b>"
      diff = PrettyDiff::Diff.new(text)
      assert_equal "&lt;b&gt;Funky HTML&lt;/b&gt;", diff.input
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pretty_diff-0.9.3 test/diff_test.rb
pretty_diff-0.9.2 test/diff_test.rb
pretty_diff-0.9.1 test/diff_test.rb
pretty_diff-0.8.1 test/diff_test.rb
pretty_diff-0.8.0 test/diff_test.rb
pretty_diff-0.7.0 test/diff_test.rb