Project

General

Profile

Defect #31507 » 31507-v2.patch

Go MAEDA, 2024-01-28 09:29

View differences:

test/unit/lib/redmine/unified_diff_test.rb
92 92
    raw = <<~DIFF
93 93
      --- test.orig.txt Wed Feb 15 16:10:39 2012
94 94
      +++ test.new.txt  Wed Feb 15 16:11:25 2012
95
      @@ -1,5 +1,5 @@
95
      @@ -1,4 +1,4 @@
96 96
       Semicolons were mysteriously appearing in code diffs in the repository
97
        
97
       ```
98 98
      -void DoSomething(std::auto_ptr<MyClass> myObj)
99 99
      +void DoSomething(const MyClass& myObj)
100
       
100
       ```
101 101
    DIFF
102 102
    diff = Redmine::UnifiedDiff.new(raw, :type => 'sbs')
103 103
    assert_equal 1, diff.size
......
385 385
  end
386 386

  
387 387
  def test_keep_similar_git_footer_line
388
    raw = <<~'DIFF'
388
    raw = <<~DIFF
389 389
      diff --git a/test1.txt b/test1.txt
390 390
      --- a/test1.txt
391 391
      +++ b/test1.txt
......
395 395
       $ cd git_utf8_repository_hg
396 396
      --
397 397
      -Next line has white space after '-'
398
      -- 
398
      --\s
399 399
      ---
400 400
      --
401 401
       $ touch test.txt
402 402
       $ hg add test.txt
403
       $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"`
403
       $ hg commit -m `echo -e "U+1F603\\U1F603"` -u `echo -e "U+1F603\\U1F603"`
404 404
      diff --git a/test2.txt b/test2.txt
405 405
      --- a/test2.txt
406 406
      +++ b/test2.txt
407 407
      @@ -5,9 +5,4 @@
408 408
       $ hg add test.txt
409
       $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"`
409
       $ hg commit -m `echo -e "U+1F603\\U1F603"` -u `echo -e "U+1F603\\U1F603"`
410 410
       $ hg bookmark master
411 411
      --
412 412
      -Next line has white space after '-'
413
      -- 
413
      --\s
414 414
      ---
415 415
      --
416 416
       $ hg push ../git_utf8_repository
......
425 425
  end
426 426

  
427 427
  def test_git_footer_line
428
    raw = <<~'DIFF'
428
    raw = <<~DIFF
429 429
      From 1ed13eda266a3e0a5a8624e79ae28874ebcdeb5c Mon Sep 17 00:00:00 2001
430 430
      From: test <none@none>
431 431
      Date: Thu, 30 Apr 2020 11:40:20 +0900
432 432
      Subject: [PATCH] add 'rpm -q git' and its result
433
      
433

  
434 434
      ---
435 435
       test.txt | 2 ++
436 436
       1 file changed, 2 insertions(+)
......
440 440
      --- a/test.txt
441 441
      +++ b/test.txt
442 442
      @@ -6,3 +6,5 @@ $ hg add test.txt
443
       $ hg commit -m `echo -e "U+1F603\U1F603"` -u `echo -e "U+1F603\U1F603"`
443
       $ hg commit -m `echo -e "U+1F603\\U1F603"` -u `echo -e "U+1F603\\U1F603"`
444 444
       $ hg bookmark master
445 445
       $ hg push ../git_utf8_repository
446 446
      +$ rpm -q git
447 447
      +git-1.8.3.1-21.el7_7.x86_64
448
      -- 
448
      --\s
449 449
      1.8.3.1
450
      
450

  
451 451
    DIFF
452 452
    lines = raw.split("\n")
453 453
    lines << ""
(4-4/4)