Fix zlib-error-message to include human-readable version
The error string is looked up in an array, but because zlib error codes are negative, the error's string was always "f".db4
parent
90422d8835
commit
b85d26759a
|
@ -1,9 +1,12 @@
|
|||
! Copyright (C) 2009 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel tools.test compression.zlib classes ;
|
||||
USING: accessors kernel tools.test compression.zlib classes ;
|
||||
QUALIFIED-WITH: compression.zlib.ffi ffi
|
||||
IN: compression.zlib.tests
|
||||
|
||||
: compress-me ( -- byte-array ) B{ 1 2 3 4 5 } ;
|
||||
|
||||
[ t ] [ compress-me [ compress uncompress ] keep = ] unit-test
|
||||
[ t ] [ compress-me compress compressed instance? ] unit-test
|
||||
|
||||
[ ffi:Z_DATA_ERROR zlib-error-message ] [ string>> "data error" = ] must-fail-with
|
||||
|
|
|
@ -19,7 +19,9 @@ ERROR: zlib-failed n string ;
|
|||
dup compression.zlib.ffi:Z_ERRNO = [
|
||||
drop errno "native libc error"
|
||||
] [
|
||||
dup {
|
||||
dup
|
||||
-1 * ! zlib error codes are negative
|
||||
{
|
||||
"no error" "libc_error"
|
||||
"stream error" "data error"
|
||||
"memory error" "buffer error" "zlib version error"
|
||||
|
|
Loading…
Reference in New Issue