File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 6
6
- " 0.12"
7
7
- " 4"
8
8
- " 5"
9
+ - " 6"
9
10
env :
10
11
matrix :
11
12
- TEST_SUITE=unit
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ HashBase.prototype._flush = function (callback) {
41
41
HashBase . prototype . update = function ( data , encoding ) {
42
42
if ( ! Buffer . isBuffer ( data ) && typeof data !== 'string' ) throw new TypeError ( 'Data must be a string or a buffer' )
43
43
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 )
45
45
46
46
// consume data
47
47
var block = this . _block
Original file line number Diff line number Diff line change 1
1
'use strict'
2
- var test = require ( 'tape' ) . test
2
+ var test = require ( 'tape' )
3
3
var HashBase = require ( '../' )
4
4
5
5
function beforeEach ( t ) {
@@ -87,11 +87,13 @@ test('update', function (t) {
87
87
t . end ( )
88
88
} )
89
89
90
- t . test ( 'decode string with binary by default' , function ( t ) {
90
+ t . test ( 'decode string with utf8 by default' , function ( t ) {
91
91
t . plan ( 1 )
92
92
var buffer = new Buffer ( 64 )
93
+ buffer . fill ( 0 )
94
+ new Buffer ( 'УТФ-8' , 'utf8' ) . copy ( buffer )
93
95
t . base . _update = function ( ) { t . same ( this . _block , buffer ) }
94
- t . base . update ( buffer . toString ( 'binary ' ) )
96
+ t . base . update ( buffer . toString ( 'utf8 ' ) )
95
97
t . end ( )
96
98
} )
97
99
You can’t perform that action at this time.
0 commit comments