bug-libunistring
[Top][All Lists]
Advanced

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

Re: [bug-libunistring] FAIL: uniname/test-uninames.sh


From: Daiki Ueno
Subject: Re: [bug-libunistring] FAIL: uniname/test-uninames.sh
Date: Mon, 06 Apr 2015 16:13:00 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Jack Howarth <address@hidden> writes:

> FAIL: uniname/test-uninames.sh
> ==============================
>
> inverse name lookup of "ZERO WIDTH JOINER" returned 0x01A3
> inverse name lookup of "ZERO WIDTH JOINER" returned 0x01A3
> FAIL uniname/test-uninames.sh (exit status: 1)

Thanks for the report.  This is a bug in the test case which expects a
failure on looking up a randomly generated character name.  Since the
recent addition of character name alias support, the generated character
name could be a valid alias, on rare occasions.

Could you try the attached patch?

The patch is for gnulib, so you will need to apply it with:

  $ patch -p3 tests/uniname/test-uninames.c < patch

Regards,
-- 
Daiki Ueno
>From 75e72aabdd7215566387f3dd4e3f253efa9d681a Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Mon, 6 Apr 2015 15:38:52 +0900
Subject: [PATCH] uniname/uniname-tests: fix failure due to alias

Reported by Jack Howarth in:
<https://lists.gnu.org/archive/html/bug-libunistring/2015-04/msg00000.html>.
* tests/uniname/test-uninames.c (name_has_alias): New function.
(test_inverse_lookup): Exclude existing alias from the randomly
generated character names.
(main): Fill unicode_aliases before calling test functions.
---
 ChangeLog                     | 10 ++++++++++
 tests/uniname/test-uninames.c | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2cf42d2..6495ccf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-04-06  Daiki Ueno  <address@hidden>
+
+       uniname/uniname-tests: fix failure due to alias
+       Reported by Jack Howarth in:
+       
<https://lists.gnu.org/archive/html/bug-libunistring/2015-04/msg00000.html>.
+       * tests/uniname/test-uninames.c (name_has_alias): New function.
+       (test_inverse_lookup): Exclude existing alias from the randomly
+       generated character names.
+       (main): Fill unicode_aliases before calling test functions.
+
 2015-04-03  Giuseppe Scrivano  <address@hidden>
 
        hash: remove deprecated hash_insert0 function
diff --git a/tests/uniname/test-uninames.c b/tests/uniname/test-uninames.c
index eccf2f4..e4435e6 100644
--- a/tests/uniname/test-uninames.c
+++ b/tests/uniname/test-uninames.c
@@ -181,6 +181,16 @@ fill_aliases (const char *namealiases_filename)
     }
 }
 
+static int
+name_has_alias (unsigned int uc)
+{
+  int i;
+  for (i = 0; i < ALIASLEN; i++)
+    if (unicode_aliases[i].uc == uc)
+      return 1;
+  return 0;
+}
+
 /* Perform an exhaustive test of the unicode_character_name function.  */
 static int
 test_name_lookup ()
@@ -296,6 +306,7 @@ test_inverse_lookup ()
 
                 result = unicode_name_character (buf);
                 if (result != UNINAME_INVALID
+                    && !name_has_alias (result)
                     && !(unicode_names[result] != NULL
                          && strcmp (unicode_names[result], buf) == 0))
                   {
@@ -354,15 +365,14 @@ main (int argc, char *argv[])
   set_program_name (argv[0]);
 
   fill_names (argv[1]);
+  if (argc > 2)
+    fill_aliases (argv[2]);
 
   error |= test_name_lookup ();
   error |= test_inverse_lookup ();
 
   if (argc > 2)
-    {
-      fill_aliases (argv[2]);
-      error |= test_alias_lookup ();
-    }
+    error |= test_alias_lookup ();
 
   return error;
 }
-- 
2.1.0


reply via email to

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