summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-02-05 07:53:11 +0000
committerGo MAEDA <maeda@farend.jp>2024-02-05 07:53:11 +0000
commit04992e0c0f388bdad4ad4427d345116887da085d (patch)
tree50388c577231f8d0a29c662b2104968faa7f1782
parent929b2f2cdb9d24174c99125bed9f2525edb742eb (diff)
downloadredmine-04992e0c0f388bdad4ad4427d345116887da085d.tar.gz
redmine-04992e0c0f388bdad4ad4427d345116887da085d.zip
Ensure tests remain robust against trailing whitespace removal (#31507).
git-svn-id: https://svn.redmine.org/redmine/trunk@22679 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/unit/lib/redmine/unified_diff_test.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/unit/lib/redmine/unified_diff_test.rb b/test/unit/lib/redmine/unified_diff_test.rb
index 87e9d072f..87c937651 100644
--- a/test/unit/lib/redmine/unified_diff_test.rb
+++ b/test/unit/lib/redmine/unified_diff_test.rb
@@ -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