poke-devel
[Top][All Lists]
Advanced

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

[PATCH] pickles, testsuite: Fix `pktest` to report more info on failure


From: Mohammad-Reza Nabipoor
Subject: [PATCH] pickles, testsuite: Fix `pktest` to report more info on failure
Date: Tue, 30 Nov 2021 21:26:47 +0330

2021-11-30  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * pickles/pktest.pk (pktest_run): Report location and message of
        failed assertion (if available) in output.
        * testsuite/poke.pktest/pktest-5.pk: Update accordingly.
        * testsuite/poke.pktest/pktest-7.pk: Likewise.
        * testsuite/poke.pktest/pktest-11.pk: Likewise.
        * testsuite/poke.pktest/pktest-12.pk: Likewise.
---
 ChangeLog                          | 9 +++++++++
 pickles/pktest.pk                  | 5 ++++-
 testsuite/poke.pktest/pktest-11.pk | 4 ++--
 testsuite/poke.pktest/pktest-12.pk | 3 ++-
 testsuite/poke.pktest/pktest-5.pk  | 4 ++--
 testsuite/poke.pktest/pktest-7.pk  | 4 ++--
 6 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2e171c6f..db2b68c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-11-30  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * pickles/pktest.pk (pktest_run): Report location and message of
+       failed assertion (if available) in output.
+       * testsuite/poke.pktest/pktest-5.pk: Update accordingly.
+       * testsuite/poke.pktest/pktest-7.pk: Likewise.
+       * testsuite/poke.pktest/pktest-11.pk: Likewise.
+       * testsuite/poke.pktest/pktest-12.pk: Likewise.
+
 2021-11-30  Jose E. Marchesi  <jemarch@gnu.org>
 
        * libpoke/pvm-val.c (pvm_array_set): Avoid calculating the size of
diff --git a/pickles/pktest.pk b/pickles/pktest.pk
index d97913fb..a360dc17 100644
--- a/pickles/pktest.pk
+++ b/pickles/pktest.pk
@@ -68,8 +68,11 @@ fun pktest_run = (PkTest[] tests, string skip = "") int:
         try t.func(t.name);
         catch (Exception ex)
           {
+            var loc = ex.location'length == 0 ? "" : " at " + ex.location;
+            var msg = ex.msg'length == 0 ? "" : " " + ex.msg;
+
             ok = 0;
-            printf "not ok %u64d %s: %s", i, t.name, ex.name;
+            printf "not ok %u64d %s: %s", i, t.name, ex.name + loc + msg;
             todo ();
             continue;
           }
diff --git a/testsuite/poke.pktest/pktest-11.pk 
b/testsuite/poke.pktest/pktest-11.pk
index 6744c5de..5f9fbbb7 100644
--- a/testsuite/poke.pktest/pktest-11.pk
+++ b/testsuite/poke.pktest/pktest-11.pk
@@ -27,7 +27,7 @@ var tests = [
 /* { dg-command {var ok = pktest_run (tests)} } */
 /* { dg-output "1..2\\nok 1 a failing test # SKIP" } */
 /* { dg-output " reason to skip this test case\\n" } */
-/* { dg-output "not ok 2 another failing test: assertion failed at" } */
-/* { dg-output ".*:22:9 # TODO WIP\\n" } */
+/* { dg-output "not ok 2 another failing test: assertion failure at" } */
+/* { dg-output ".*:22:9: # TODO WIP\\n" } */
 /* { dg-command {ok} } */
 /* { dg-output "0" } */
diff --git a/testsuite/poke.pktest/pktest-12.pk 
b/testsuite/poke.pktest/pktest-12.pk
index 174d10cc..d5a1f7fe 100644
--- a/testsuite/poke.pktest/pktest-12.pk
+++ b/testsuite/poke.pktest/pktest-12.pk
@@ -14,4 +14,5 @@ var tests = [
   },
 ];
 
-/* { dg-output "unhandled constraint violation in field PkTest.todo exception" 
} */
+/* { dg-output "unhandled constraint violation exception\n" } */
+/* { dg-output "constraint expression failed for field PkTest.todo" } */
diff --git a/testsuite/poke.pktest/pktest-5.pk 
b/testsuite/poke.pktest/pktest-5.pk
index 3e9400db..c549d2e0 100644
--- a/testsuite/poke.pktest/pktest-5.pk
+++ b/testsuite/poke.pktest/pktest-5.pk
@@ -13,7 +13,7 @@ var tests = [
 ];
 
 /* { dg-command {var ok = pktest_run (tests)} } */
-/* { dg-output "1..1\\nnot ok 1 a failing test: assertion failed at" } */
-/* { dg-output " .*:10:9\\n" } */
+/* { dg-output "1..1\\nnot ok 1 a failing test: assertion failure at" } */
+/* { dg-output " .*:10:9:\\n" } */
 /* { dg-command {ok} } */
 /* { dg-output "0" } */
diff --git a/testsuite/poke.pktest/pktest-7.pk 
b/testsuite/poke.pktest/pktest-7.pk
index 08ea0267..1a57629d 100644
--- a/testsuite/poke.pktest/pktest-7.pk
+++ b/testsuite/poke.pktest/pktest-7.pk
@@ -21,8 +21,8 @@ var tests = [
 
 /* { dg-command {var ok = pktest_run (tests)} } */
 /* { dg-output "1..2\\nnot ok 1 a failing test:" } */
-/* { dg-output " assertion failed at .*:10:9\\n" } */
+/* { dg-output " assertion failure at .*:10:9:\\n" } */
 /* { dg-output "not ok 2 another failing test:" } */
-/* { dg-output " assertion failed at .*:17:9\\n" } */
+/* { dg-output " assertion failure at .*:17:9:\\n" } */
 /* { dg-command {ok} } */
 /* { dg-output "0" } */
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]