From: Michael Wallner Date: Thu, 7 Sep 2017 12:03:45 +0000 (+0200) Subject: tests: parse idna.h instead of manual decls X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=2ec486c0aab0a9f74fb4b3a567799239ccf87186 tests: parse idna.h instead of manual decls --- diff --git a/tests/idn/idn.psi b/tests/idn/idn.psi index b8f3602..aaf0f81 100644 --- a/tests/idn/idn.psi +++ b/tests/idn/idn.psi @@ -1,35 +1,17 @@ // libidn lib "idn"; -// IDNA errors -const int \IDNA_SUCCESS = 0; -const int \IDNA_STRINGPREP_ERROR = 1; -const int \IDNA_PUNYCODE_ERROR = 2; -const int \IDNA_CONTAINS_NON_LDH = 3; -const int \IDNA_CONTAINS_LDH = 3; -const int \IDNA_CONTAINS_MINUS = 4; -const int \IDNA_INVALID_LENGTH = 5; -const int \IDNA_NO_ACE_PREFIX = 6; -const int \IDNA_ROUNDTRIP_VERIFY_ERROR = 7; -const int \IDNA_CONTAINS_ACE_PREFIX = 8; -const int \IDNA_ICONV_ERROR = 9; -const int \IDNA_MALLOC_ERROR = 201; -const int \IDNA_DLOPEN_ERROR = 202; -// IDNA flags -const int \IDNA_ALLOW_UNASSIGNED = 1; -const int \IDNA_USE_STD3_ASCII_RULES = 2; +#include - -default int idna_to_ascii_8z(char *host, char **buffer, int flags); function idn\utf8_to_ascii(string $host, string &$result, int $flags = 0) : int { - let buffer = &NULL; - let host = strval($host); + let output = &NULL; + let input = strval($host); let flags = intval($flags); - set $result = to_string(*buffer); + set $result = to_string(*output); return to_int(idna_to_ascii_8z); - free free(*buffer); + free free(*output); } -default char *idna_strerror(int rc); + function idn\strerror(int $rc) : string { return to_string(idna_strerror); let rc = intval($rc); diff --git a/tests/idn/idn002.phpt b/tests/idn/idn002.phpt index d3d3375..da1d532 100644 --- a/tests/idn/idn002.phpt +++ b/tests/idn/idn002.phpt @@ -11,7 +11,7 @@ function_exists("idn\\strerror") or die("skip - need libidn"); ===TEST===