[gjs/mozjs78: 12/17] tests: Fix specifics in tests to match SpiderMonkey 78 output




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

    tests: Fix specifics in 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.
    
    The gjs_parse_call_args() tests depend on the text of certain error
    messages, which were changed in SpiderMonkey 78.
    
    See: GNOME/gjs#329

 test/gjs-test-call-args.cpp |  8 ++++----
 test/gjs-test-coverage.cpp  | 21 +++++++++++----------
 2 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/test/gjs-test-call-args.cpp b/test/gjs-test-call-args.cpp
index 670e1d70..584745e9 100644
--- a/test/gjs-test-call-args.cpp
+++ b/test/gjs-test-call-args.cpp
@@ -361,11 +361,11 @@ gjs_test_add_tests_for_parse_call_args(void)
                              "optionalIntArgsNoAssert(1, 2, 3)"
                              "//*Expected minimum 1 arguments (and 1 optional), got 3");
     ADD_CALL_ARGS_TEST_XFAIL("too-few-args-fails",
-                             "intArgNoAssert()//*requires at least 1 argument, "
-                             "but only 0 were passed");
+                             "intArgNoAssert()//*At least 1 argument required, "
+                             "but only 0 passed");
     ADD_CALL_ARGS_TEST_XFAIL("too-few-args-fails-with-optional",
-                             "optionalIntArgsNoAssert()//*requires at least 1 "
-                             "argument, but only 0 were passed");
+                             "optionalIntArgsNoAssert()//*At least 1 argument "
+                             "required, but only 0 passed");
     ADD_CALL_ARGS_TEST("args-ignores-trailing", "argsIgnoreTrailing(1, 2, 3)");
     ADD_CALL_ARGS_TEST("one-of-each-type-works",
                        "oneOfEachType(true, 'foo', 'foo', 1, 1, 1, 1, {})");
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]