File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 3
3
require ( '../common' ) ;
4
4
const assert = require ( 'assert' ) ;
5
5
const inherits = require ( 'util' ) . inherits ;
6
+ const errCheck =
7
+ new RegExp ( '^TypeError: The super constructor to "inherits" must not be ' +
8
+ 'null or undefined$' ) ;
9
+
6
10
7
11
// super constructor
8
12
function A ( ) {
@@ -75,6 +79,12 @@ assert.strictEqual(e.e(), 'e');
75
79
assert . strictEqual ( e . constructor , E ) ;
76
80
77
81
// should throw with invalid arguments
78
- assert . throws ( function ( ) { inherits ( A , { } ) ; } , TypeError ) ;
79
- assert . throws ( function ( ) { inherits ( A , null ) ; } , TypeError ) ;
80
- assert . throws ( function ( ) { inherits ( null , A ) ; } , TypeError ) ;
82
+ assert . throws ( function ( ) {
83
+ inherits ( A , { } ) ;
84
+ } , / ^ T y p e E r r o r : T h e s u p e r c o n s t r u c t o r t o " i n h e r i t s " m u s t h a v e a p r o t o t y p e $ / ) ;
85
+ assert . throws ( function ( ) {
86
+ inherits ( A , null ) ;
87
+ } , errCheck ) ;
88
+ assert . throws ( function ( ) {
89
+ inherits ( null , A ) ;
90
+ } , / ^ T y p e E r r o r : T h e c o n s t r u c t o r t o " i n h e r i t s " m u s t n o t b e n u l l o r u n d e f i n e d $ / ) ;
You can’t perform that action at this time.
0 commit comments