summaryrefslogtreecommitdiffstats
path: root/test/unit/lib/redmine/unified_diff_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-15 17:39:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-15 17:39:47 +0000
commit6aae25209a07a49a2414193ba1500d135c1b497e (patch)
treef0b42f45dd56936668462ddb23b8d11f4e3ab8f9 /test/unit/lib/redmine/unified_diff_test.rb
parent008557581d8a9a428c262e09fe8f36060fe945b9 (diff)
downloadredmine-6aae25209a07a49a2414193ba1500d135c1b497e.tar.gz
redmine-6aae25209a07a49a2414193ba1500d135c1b497e.zip
Fixed that partial diffs are done against html instead of original code (#9143).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8876 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib/redmine/unified_diff_test.rb')
-rw-r--r--test/unit/lib/redmine/unified_diff_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/unified_diff_test.rb b/test/unit/lib/redmine/unified_diff_test.rb
index 8d3e70497..01b899a02 100644
--- a/test/unit/lib/redmine/unified_diff_test.rb
+++ b/test/unit/lib/redmine/unified_diff_test.rb
@@ -91,6 +91,29 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
end
+ def test_partials_with_html_entities
+ raw = <<-DIFF
+--- test.orig.txt Wed Feb 15 16:10:39 2012
++++ test.new.txt Wed Feb 15 16:11:25 2012
+@@ -1,5 +1,5 @@
+ Semicolons were mysteriously appearing in code diffs in the repository
+
+-void DoSomething(std::auto_ptr<MyClass> myObj)
++void DoSomething(const MyClass& myObj)
+
+DIFF
+
+ diff = Redmine::UnifiedDiff.new(raw, :type => 'sbs')
+ assert_equal 1, diff.size
+ assert_equal 'void DoSomething(<span>std::auto_ptr&lt;MyClass&gt;</span> myObj)', diff.first[2].html_line_left
+ assert_equal 'void DoSomething(<span>const MyClass&amp;</span> myObj)', diff.first[2].html_line_right
+
+ diff = Redmine::UnifiedDiff.new(raw, :type => 'inline')
+ assert_equal 1, diff.size
+ assert_equal 'void DoSomething(<span>std::auto_ptr&lt;MyClass&gt;</span> myObj)', diff.first[2].html_line
+ assert_equal 'void DoSomething(<span>const MyClass&amp;</span> myObj)', diff.first[3].html_line
+ end
+
def test_line_starting_with_dashes
diff = Redmine::UnifiedDiff.new(<<-DIFF
--- old.txt Wed Nov 11 14:24:58 2009