File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 66 - " 0.12"
77 - " 4"
88 - " 5"
9+ - " 6"
910env :
1011 matrix :
1112 - TEST_SUITE=unit
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ HashBase.prototype._flush = function (callback) {
4141HashBase . prototype . update = function ( data , encoding ) {
4242 if ( ! Buffer . isBuffer ( data ) && typeof data !== 'string' ) throw new TypeError ( 'Data must be a string or a buffer' )
4343 if ( this . _finalized ) throw new Error ( 'Digest already called' )
44- if ( ! Buffer . isBuffer ( data ) ) data = new Buffer ( data , encoding || 'binary' )
44+ if ( ! Buffer . isBuffer ( data ) ) data = new Buffer ( data , encoding )
4545
4646 // consume data
4747 var block = this . _block
Original file line number Diff line number Diff line change 11'use strict'
2- var test = require ( 'tape' ) . test
2+ var test = require ( 'tape' )
33var HashBase = require ( '../' )
44
55function beforeEach ( t ) {
@@ -87,11 +87,13 @@ test('update', function (t) {
8787 t . end ( )
8888 } )
8989
90- t . test ( 'decode string with binary by default' , function ( t ) {
90+ t . test ( 'decode string with utf8 by default' , function ( t ) {
9191 t . plan ( 1 )
9292 var buffer = new Buffer ( 64 )
93+ buffer . fill ( 0 )
94+ new Buffer ( 'УТФ-8' , 'utf8' ) . copy ( buffer )
9395 t . base . _update = function ( ) { t . same ( this . _block , buffer ) }
94- t . base . update ( buffer . toString ( 'binary ' ) )
96+ t . base . update ( buffer . toString ( 'utf8 ' ) )
9597 t . end ( )
9698 } )
9799
You can’t perform that action at this time.
0 commit comments