[SCM] ci-tooling packaging branch, master, updated. c8bb08da4d11808da041234b3a3a9fac9332fb62

Harald Sitter apachelogger-guest at moszumanska.debian.org
Tue Apr 28 12:23:00 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=48fa30c

The following commit has been merged in the master branch:
commit 48fa30c0c374436a037dc6b07a1de76f6f2d408d
Author: Harald Sitter <sitter at kde.org>
Date:   Tue Apr 28 14:08:43 2015 +0200

    allow lint results to be merged
---
 lib/lint/result.rb       |  7 +++++++
 test/test_lint_result.rb | 22 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/lib/lint/result.rb b/lib/lint/result.rb
index 703e9b5..c39dc7c 100644
--- a/lib/lint/result.rb
+++ b/lib/lint/result.rb
@@ -12,6 +12,13 @@ module Lint
       @warnings = []
       @informations = []
     end
+
+    def merge!(other)
+      @valid = other.valid unless @valid
+      @errors += other.errors
+      @warnings += other.warnings
+      @informations += other.informations
+    end
   end
 
   # Logs arary of results to stdout
diff --git a/test/test_lint_result.rb b/test/test_lint_result.rb
index b6f3989..c366762 100644
--- a/test/test_lint_result.rb
+++ b/test/test_lint_result.rb
@@ -22,4 +22,26 @@ class LintResultTest < TestCase
     assert_equal(r, l.results.first)
     l.log
   end
+
+  def test_merge
+    r1 = Lint::Result.new
+    r1.valid = true
+    r1.errors << 'error'
+    r1.warnings << 'warning'
+    r1.informations << 'info'
+
+    r2 = Lint::Result.new
+    r2.valid = false
+    r2.errors << 'error2'
+    r2.warnings << 'warning2'
+    r2.informations << 'info2'
+
+    r3 = Lint::Result.new
+    r3.merge!(r1)
+    r3.merge!(r2)
+    assert(r3.valid)
+    assert_equal(r1.errors + r2.errors, r3.errors)
+    assert_equal(r1.warnings + r2.warnings, r3.warnings)
+    assert_equal(r1.informations + r2.informations, r3.informations)
+  end
 end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list