Bug 1373794 - Test parsing LCOV containing a function name with commas. r=chmanchester
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Sat, 17 Jun 2017 01:27:32 +0100
changeset 596762 4e09847ffa5892df0d156a2282219b1f56edce8b
parent 596761 76ba64f4ee9ca7508bb1be3f912d3bd5ad04920f
child 596763 44031d37013371ca2078dea6fdfbe346342c27f6
push id64751
push userbmo:rbarker@mozilla.com
push dateMon, 19 Jun 2017 19:08:32 +0000
reviewerschmanchester
bugs1373794
milestone56.0a1
Bug 1373794 - Test parsing LCOV containing a function name with commas. r=chmanchester
python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py
--- a/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py
+++ b/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py
@@ -78,16 +78,32 @@ DA:23,1
 DA:25,1
 DA:401,0
 DA:407,1
 LF:10
 LH:8
 end_of_record
 """
 
+fn_with_multiple_commas = """TN:Compartment_5f7f5c30251800
+SF:resource://gre/modules/osfile.jsm
+FN:1,function,name,with,commas
+FNDA:1,function,name,with,commas
+FNF:1
+FNH:1
+BRDA:9,0,61,1
+BRF:1
+BRH:1
+DA:9,1
+DA:24,1
+LF:2
+LH:2
+end_of_record
+"""
+
 class TestLcovParser(unittest.TestCase):
 
     def get_lcov(self, lcov_string):
         fh = StringIO(lcov_string)
         return lcov_rewriter.LcovFile(fh)
 
     def parser_roundtrip(self, lcov_string, resummarize=False):
         file_obj = self.get_lcov(lcov_string)
@@ -107,16 +123,19 @@ class TestLcovParser(unittest.TestCase):
 
     def test_resummarize(self):
         output = self.parser_roundtrip(basic_file, True)
         self.assertEqual(basic_file, output)
 
         output = self.parser_roundtrip(multiple_records, True)
         self.assertEqual(multiple_records, output)
 
+    def test_multiple_commas(self):
+        output = self.parser_roundtrip(fn_with_multiple_commas, True)
+        self.assertEqual(fn_with_multiple_commas, output)
 
 multiple_included_files = """//@line 1 "foo.js"
 bazfoobar
 //@line 2 "bar.js"
 @foo@
 //@line 3 "foo.js"
 bazbarfoo
 //@line 2 "bar.js"