incubator-rat-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1145273 - in /incubator/rat/eye/trunk: org/apache/rat/eye/engine.py test/test_engine.py
Date Mon, 11 Jul 2011 18:27:32 GMT
Author: rdonkin
Date: Mon Jul 11 18:27:31 2011
New Revision: 1145273

URL: http://svn.apache.org/viewvc?rev=1145273&view=rev
Log:
Store all reports in unified list.

Modified:
    incubator/rat/eye/trunk/org/apache/rat/eye/engine.py
    incubator/rat/eye/trunk/test/test_engine.py

Modified: incubator/rat/eye/trunk/org/apache/rat/eye/engine.py
URL: http://svn.apache.org/viewvc/incubator/rat/eye/trunk/org/apache/rat/eye/engine.py?rev=1145273&r1=1145272&r2=1145273&view=diff
==============================================================================
--- incubator/rat/eye/trunk/org/apache/rat/eye/engine.py (original)
+++ incubator/rat/eye/trunk/org/apache/rat/eye/engine.py Mon Jul 11 18:27:31 2011
@@ -253,17 +253,11 @@ class Reports():
     Collects reports.
     """
     def __init__(self):
-        self.info = []
-        self.hazards = []
-        self.blockers = []
+        self.reports = []
         
-    def addReports(self, blockers, hazards, info):
-        if not (blockers is None):
-            self.blockers.extend(blockers)
-        if not (hazards is None):
-            self.hazards.extend(hazards)
-        if not (hazards is None):
-            self.info.extend(info)
+    def addReports(self, reports):
+        if not (reports is None):
+            self.reports.extend(reports)
         return self
     
 class Directory(Reports):

Modified: incubator/rat/eye/trunk/test/test_engine.py
URL: http://svn.apache.org/viewvc/incubator/rat/eye/trunk/test/test_engine.py?rev=1145273&r1=1145272&r2=1145273&view=diff
==============================================================================
--- incubator/rat/eye/trunk/test/test_engine.py (original)
+++ incubator/rat/eye/trunk/test/test_engine.py Mon Jul 11 18:27:31 2011
@@ -228,39 +228,19 @@ class TestEngine(unittest.TestCase):
         engine.AccumulativeScanner()
         
     def testAppendFirstReport(self):
-        blockers = ["whatever"]
-        hazards = ["one", "two"]
-        info = []
-        
-        subject = engine.Reports().addReports(blockers, hazards, info)
-        
-        self.assertEquals(subject.blockers, blockers)
-        self.assertEquals(subject.hazards, hazards)
-        self.assertEquals(subject.info, info)
-    
+        reports = ["whatever"]
+        self.assertEquals(engine.Reports().addReports(reports).reports, reports)
+        
     def testAppendReportNone(self):
-        subject = engine.Reports().addReports(None, None, None)
+        self.assertEquals(engine.Reports().addReports(None).reports, [])
         
-        self.assertEquals(subject.blockers, [])
-        self.assertEquals(subject.hazards, [])
-        self.assertEquals(subject.info, [])
-    
     def testAppendAnotherReport(self):
-        blockers = ["tom"]
-        hazards = ["dick"]
-        info = ["harry"]
-        
-        subject = engine.Reports().addReports(blockers, hazards, info)
-        
-        extra_blockers = ["one"]
-        extra_hazards = ["two"]
-        extra_info = ["three"]
-        
-        subject = subject.addReports(extra_blockers, extra_hazards, extra_info)
+        reports = ["tom"]
+        extra_reports = ["one"]
         
-        self.assertEquals(subject.blockers, blockers + extra_blockers)
-        self.assertEquals(subject.hazards, hazards + extra_hazards)
-        self.assertEquals(subject.info, info + extra_info)
+        self.assertEquals(engine.Reports().addReports(reports)
+                          .addReports(extra_reports).reports,
+                          reports + extra_reports)
         
     def testReviewerSmokeOrChoke(self):
         engine.Reviewer([]).review([])



Mime
View raw message