]> source.dussan.org Git - redmine.git/commitdiff
Ensure tests remain robust against trailing whitespace removal (#31507).
authorGo MAEDA <maeda@farend.jp>
Mon, 5 Feb 2024 07:53:11 +0000 (07:53 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 5 Feb 2024 07:53:11 +0000 (07:53 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@22679 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/lib/redmine/unified_diff_test.rb

index 87e9d072f2e7c190a9968aecd2ab81907dfbf729..87c93765145d45d39c5a5c5b0588005629d14e3c 100644 (file)
@@ -92,12 +92,12 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
     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 @@
+      @@ -1,4 +1,4 @@
        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
@@ -385,7 +385,7 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
   end
 
   def test_keep_similar_git_footer_line
-    raw = <<~'DIFF'
+    raw = <<~DIFF
       diff --git a/test1.txt b/test1.txt
       --- a/test1.txt
       +++ b/test1.txt
@@ -395,22 +395,22 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
        $ cd git_utf8_repository_hg
       --
       -Next line has white space after '-'
-      -- 
+      --\s
       ---
       --
        $ touch test.txt
        $ hg add test.txt
-       $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"`
+       $ hg commit -m `echo -e "U+1F603\\U1F603"` -u `echo -e "U+1F603\\U1F603"`
       diff --git a/test2.txt b/test2.txt
       --- a/test2.txt
       +++ b/test2.txt
       @@ -5,9 +5,4 @@
        $ hg add test.txt
-       $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"`
+       $ hg commit -m `echo -e "U+1F603\\U1F603"` -u `echo -e "U+1F603\\U1F603"`
        $ hg bookmark master
       --
       -Next line has white space after '-'
-      -- 
+      --\s
       ---
       --
        $ hg push ../git_utf8_repository
@@ -425,7 +425,7 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
   end
 
   def test_git_footer_line
-    raw = <<~'DIFF'
+    raw = <<~DIFF
       From 1ed13eda266a3e0a5a8624e79ae28874ebcdeb5c Mon Sep 17 00:00:00 2001
       From: test <none@none>
       Date: Thu, 30 Apr 2020 11:40:20 +0900
@@ -440,12 +440,12 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase
       --- a/test.txt
       +++ b/test.txt
       @@ -6,3 +6,5 @@ $ hg add test.txt
-       $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"`
+       $ hg commit -m `echo -e "U+1F603\\U1F603"` -u `echo -e "U+1F603\\U1F603"`
        $ hg bookmark master
        $ hg push ../git_utf8_repository
       +$ rpm -q git
       +git-1.8.3.1-21.el7_7.x86_64
-      -- 
+      --\s
       1.8.3.1
       
     DIFF