1
1
'use strict' ;
2
- var common = require ( '../common' ) ;
3
- var assert = require ( 'assert' ) ;
2
+ const common = require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
4
5
5
if ( ! common . hasCrypto ) {
6
6
common . skip ( 'missing crypto' ) ;
7
7
return ;
8
8
}
9
- var crypto = require ( 'crypto' ) ;
9
+ const crypto = require ( 'crypto' ) ;
10
10
11
11
crypto . DEFAULT_ENCODING = 'buffer' ;
12
12
@@ -29,27 +29,14 @@ process.setMaxListeners(256);
29
29
} ) ;
30
30
31
31
[ 0 , 1 , 2 , 4 , 16 , 256 , 1024 ] . forEach ( function ( len ) {
32
- f ( len , checkCall ( function ( ex , buf ) {
33
- assert . equal ( null , ex ) ;
34
- assert . equal ( len , buf . length ) ;
32
+ f ( len , common . mustCall ( function ( ex , buf ) {
33
+ assert . strictEqual ( null , ex ) ;
34
+ assert . strictEqual ( len , buf . length ) ;
35
35
assert . ok ( Buffer . isBuffer ( buf ) ) ;
36
36
} ) ) ;
37
37
} ) ;
38
38
} ) ;
39
39
40
- // assert that the callback is indeed called
41
- function checkCall ( cb , desc ) {
42
- var called_ = false ;
43
-
44
- process . on ( 'exit' , function ( ) {
45
- assert . equal ( true , called_ , desc || ( 'callback not called: ' + cb ) ) ;
46
- } ) ;
47
-
48
- return function ( ) {
49
- return called_ = true , cb . apply ( cb , Array . prototype . slice . call ( arguments ) ) ;
50
- } ;
51
- }
52
-
53
40
// #5126, "FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData()
54
41
// length exceeds max acceptable value"
55
42
assert . throws ( function ( ) {
0 commit comments