Skip to content

Commit

Permalink
test,zlib: check string strategies
Browse files Browse the repository at this point in the history
The Zlib constructor accepts strategy constants that are integers.
Current code will also work with string versions of those integers. Add
test for this situation.

Fixes: nodejs#10932
  • Loading branch information
Trott committed Jan 21, 2017
1 parent b5474c8 commit bf18ed8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/parallel/test-zlib-deflate-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ assert.doesNotThrow(
);

assert.doesNotThrow(
() => { new zlib.Deflate({ strategy: zlib.constants.Z_DEFAULT_STRATEGY}); }
() => { new zlib.Deflate({strategy: zlib.constants.Z_DEFAULT_STRATEGY}); }
);

// Valid strategies are integer values. Accepts equivalent string value too.
assert.doesNotThrow(
() => { new zlib.Deflate({strategy: '' + zlib.constants.Z_RLE}); }
);

// Throws if opts.strategy is invalid
Expand Down

0 comments on commit bf18ed8

Please sign in to comment.