[gjs/mozjs78: 48/50] tests: Fix coverage tests to match SpiderMonkey 78 output




commit 0004f9df41be3a896fe6c6632ef5335e2f4c307e
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Aug 1 14:44:08 2020 -0700

    tests: Fix coverage tests to match SpiderMonkey 78 output
    
    The LCOV output has changed slightly again in SpiderMonkey 78, so we
    must update our tests to match. There are trivial modifications such as
    changing the order that function records appear in, but it also seems
    that SpiderMonkey now reports more branches: for loop conditions and for
    default cases in switch statements.
    
    See: GNOME/gjs#329

 test/gjs-test-coverage.cpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index 6a641704..5273675b 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -564,9 +564,8 @@ static void test_multiple_branch_coverage_written_to_coverage_data(
                                           fixture->lcov_output);
 
     const BranchLineData expected_branches[] = {
-        { 3, 0, TAKEN },
-        { 3, 1, TAKEN },
-        { 3, 2, TAKEN }
+        {2, 0, TAKEN}, {2, 1, TAKEN}, {3, 0, TAKEN},
+        {3, 1, TAKEN}, {3, 2, TAKEN}, {3, 3, NOT_TAKEN},
     };
     const gsize expected_branches_len = G_N_ELEMENTS(expected_branches);
 
@@ -613,7 +612,9 @@ static void test_branches_for_multiple_case_statements_fallthrough(
                                           fixture->lcov_output);
 
     const BranchLineData expected_branches[] = {
-        {3, 0, TAKEN}, {3, 1, TAKEN}, {3, 2, NOT_TAKEN}};
+        {2, 0, TAKEN}, {2, 1, TAKEN},     {3, 0, TAKEN},
+        {3, 1, TAKEN}, {3, 2, NOT_TAKEN}, {3, 3, NOT_TAKEN},
+    };
     const gsize expected_branches_len = G_N_ELEMENTS(expected_branches);
 
     /* There are two possible branches here, the second should be taken
@@ -849,9 +850,9 @@ static void test_function_hit_counts_for_big_functions_written_to_coverage_data(
                                           fixture->lcov_output);
 
     const FunctionHitCountData expected_hit_counts[] = {
-        {"b", 1},
-        {"f", 1},
         {"top-level", 1},
+        {"f", 1},
+        {"b", 1},
     };
 
     const gsize expected_hit_count_len = G_N_ELEMENTS(expected_hit_counts);
@@ -894,9 +895,9 @@ test_function_hit_counts_for_little_functions_written_to_coverage_data(
                                           fixture->lcov_output);
 
     const FunctionHitCountData expected_hit_counts[] = {
-        {"b", 1},
-        {"f", 1},
         {"top-level", 1},
+        {"f", 1},
+        {"b", 1},
     };
 
     const gsize expected_hit_count_len = G_N_ELEMENTS(expected_hit_counts);
@@ -934,9 +935,9 @@ static void test_function_hit_counts_written_to_coverage_data(
                                           fixture->lcov_output);
 
     const FunctionHitCountData expected_hit_counts[] = {
-        {"b", 1},
-        {"f", 1},
         {"top-level", 1},
+        {"f", 1},
+        {"b", 1},
     };
 
     const gsize expected_hit_count_len = G_N_ELEMENTS(expected_hit_counts);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]