[njs] Zlib: improved tests with zlib-ng.

Dmitry Volyntsev xeioex at nginx.com
Tue Apr 23 01:09:23 UTC 2024


details:   https://hg.nginx.org/njs/rev/0cb259f67ade
branches:  
changeset: 2320:0cb259f67ade
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Apr 22 17:52:14 2024 -0700
description:
Zlib: improved tests with zlib-ng.

This fixes #704 issue on Github.

diffstat:

 src/test/njs_unit_test.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (25 lines):

diff -r d640adf691a7 -r 0cb259f67ade src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c	Mon Apr 22 17:52:06 2024 -0700
+++ b/src/test/njs_unit_test.c	Mon Apr 22 17:52:14 2024 -0700
@@ -22319,14 +22319,15 @@ static njs_unit_test_t  njs_zlib_test[] 
       njs_str("WAKA,αβγ") },
 
     { njs_str("const zlib = require('zlib');"
-              "['WAKA', 'αβγ']"
-              ".map(v => zlib.deflateRawSync(v).toString('base64'))"),
-      njs_str("C3f0dgQA,O7fx3KZzmwE=") },
+              "const enc = ['WAKA', 'αβγ'].map(v => zlib.deflateRawSync(v).toString('base64'));"
+              "enc.map(v => zlib.inflateRawSync(Buffer.from(v, 'base64')).toString())"),
+      njs_str("WAKA,αβγ") },
 
     { njs_str("const zlib = require('zlib');"
-              "['WAKA', 'αβγ']"
-              ".map(v => zlib.deflateRawSync(v, {dictionary: Buffer.from('WAKA')}).toString('base64'))"),
-      njs_str("CwdiAA==,O7fx3KZzmwE=") },
+              "const enc = ['WAKA', 'αβγ']"
+              ".map(v => zlib.deflateRawSync(v, {dictionary: Buffer.from('WAKA')}).toString('base64'));"
+              "enc.map(v => zlib.inflateRawSync(Buffer.from(v, 'base64'), {dictionary: Buffer.from('WAKA')}))"),
+      njs_str("WAKA,αβγ") },
 
     { njs_str("const zlib = require('zlib');"
               "['WAKA', 'αβγ']"


More information about the nginx-devel mailing list