bug-gnulib
[Top][All Lists]
Advanced

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

striconveh: avoid test failure with newest libiconv


From: Bruno Haible
Subject: striconveh: avoid test failure with newest libiconv
Date: Mon, 6 Apr 2009 01:32:21 +0200
User-agent: KMail/1.9.9

The test-striconveh test fails when built against libiconv 1.13. The test is
actually assuming too much about iconv's internals. This fixes the failure.

2009-04-05  Bruno Haible  <address@hidden>

        Avoid test failure with libiconv-1.13.
        * tests/test-striconveh.c (main): Allow result of libiconv 1.13 as one
        of the expected test results.

*** tests/test-striconveh.c.orig        2009-04-06 01:27:42.000000000 +0200
--- tests/test-striconveh.c     2009-04-06 01:27:15.000000000 +0200
***************
*** 1,5 ****
  /* Test of character set conversion with error handling.
!    Copyright (C) 2007-2008 Free Software Foundation, Inc.
  
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
--- 1,5 ----
  /* Test of character set conversion with error handling.
!    Copyright (C) 2007-2009 Free Software Foundation, Inc.
  
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
***************
*** 392,406 ****
            case iconveh_question_mark:
            case iconveh_escape_sequence:
              {
!               static const char expected1[] = "?????"; /* glibc */
!               static const char expected2[] = "?2D/YQNhB"; /* libiconv */
                ASSERT (retval == 0);
!               ASSERT (length == strlen (expected1) || length == strlen 
(expected2));
                ASSERT (result != NULL);
                if (length == strlen (expected1))
                  ASSERT (memcmp (result, expected1, strlen (expected1)) == 0);
!               else
                  ASSERT (memcmp (result, expected2, strlen (expected2)) == 0);
                free (result);
              }
              break;
--- 392,416 ----
            case iconveh_question_mark:
            case iconveh_escape_sequence:
              {
!               /* glibc result */
!               static const char expected1[] = "?????";
!               /* libiconv <= 1.12 result */
!               static const char expected2[] = "?2D/YQNhB";
!               /* libiconv behaviour changed in version 1.13: the result is
!                  '?' U+0FF6 U+1036; this is U+D83F U+D840 U+D841 shifted left
!                  by 6 bits.  */
!               static const char expected3[] = "?\340\277\266\341\200\266";
                ASSERT (retval == 0);
!               ASSERT (length == strlen (expected1)
!                       || length == strlen (expected2)
!                       || length == strlen (expected3));
                ASSERT (result != NULL);
                if (length == strlen (expected1))
                  ASSERT (memcmp (result, expected1, strlen (expected1)) == 0);
!               else if (length == strlen (expected2))
                  ASSERT (memcmp (result, expected2, strlen (expected2)) == 0);
+               else
+                 ASSERT (memcmp (result, expected3, strlen (expected3)) == 0);
                free (result);
              }
              break;




reply via email to

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