@@ -109,10 +109,7 @@ class MyDate extends Date {
109
109
110
110
const date2 = new MyDate ( '2016' ) ;
111
111
112
- // deepEqual returns true as long as the time are the same,
113
- // but deepStrictEqual checks own properties
114
- assert . notDeepEqual ( date , date2 ) ;
115
- assert . notDeepEqual ( date2 , date ) ;
112
+ assertNotDeepOrStrict ( date , date2 ) ;
116
113
assert . throws (
117
114
( ) => assert . deepStrictEqual ( date , date2 ) ,
118
115
{
@@ -142,9 +139,7 @@ class MyRegExp extends RegExp {
142
139
const re1 = new RegExp ( 'test' ) ;
143
140
const re2 = new MyRegExp ( 'test' ) ;
144
141
145
- // deepEqual returns true as long as the regexp-specific properties
146
- // are the same, but deepStrictEqual checks all properties
147
- assert . notDeepEqual ( re1 , re2 ) ;
142
+ assertNotDeepOrStrict ( re1 , re2 ) ;
148
143
assert . throws (
149
144
( ) => assert . deepStrictEqual ( re1 , re2 ) ,
150
145
{
@@ -684,7 +679,7 @@ assert.throws(
684
679
}
685
680
) ;
686
681
687
- assert . deepEqual ( new Date ( 2000 , 3 , 14 ) , new Date ( 2000 , 3 , 14 ) ) ;
682
+ assertDeepAndStrictEqual ( new Date ( 2000 , 3 , 14 ) , new Date ( 2000 , 3 , 14 ) ) ;
688
683
689
684
assert . throws ( ( ) => { assert . deepEqual ( new Date ( ) , new Date ( 2000 , 3 , 14 ) ) ; } ,
690
685
AssertionError ,
@@ -702,7 +697,7 @@ assert.throws(
702
697
'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
703
698
) ;
704
699
705
- assert . notDeepEqual ( new Date ( ) , new Date ( 2000 , 3 , 14 ) ) ;
700
+ assertNotDeepOrStrict ( new Date ( ) , new Date ( 2000 , 3 , 14 ) ) ;
706
701
707
702
assertDeepAndStrictEqual ( / a / , / a / ) ;
708
703
assertDeepAndStrictEqual ( / a / g, / a / g) ;
@@ -743,7 +738,7 @@ a2.b = true;
743
738
a2 . a = 'test' ;
744
739
assert . throws ( ( ) => assert . deepEqual ( Object . keys ( a1 ) , Object . keys ( a2 ) ) ,
745
740
AssertionError ) ;
746
- assert . deepEqual ( a1 , a2 ) ;
741
+ assertDeepAndStrictEqual ( a1 , a2 ) ;
747
742
748
743
// Having an identical prototype property.
749
744
const nbRoot = {
@@ -899,14 +894,12 @@ assert.throws(
899
894
900
895
/* eslint-enable */
901
896
902
- assert . deepStrictEqual ( { a : 4 , b : '1' } , { b : '1' , a : 4 } ) ;
897
+ assertDeepAndStrictEqual ( { a : 4 , b : '1' } , { b : '1' , a : 4 } ) ;
903
898
904
899
assert . throws (
905
900
( ) => assert . deepStrictEqual ( [ 0 , 1 , 2 , 'a' , 'b' ] , [ 0 , 1 , 2 , 'b' , 'a' ] ) ,
906
901
AssertionError ) ;
907
902
908
- assert . deepStrictEqual ( a1 , a2 ) ;
909
-
910
903
// Prototype check.
911
904
function Constructor1 ( first , last ) {
912
905
this . first = first ;
@@ -926,7 +919,7 @@ assert.throws(() => assert.deepStrictEqual(obj1, obj2), AssertionError);
926
919
Constructor2 . prototype = Constructor1 . prototype ;
927
920
obj2 = new Constructor2 ( 'Ryan' , 'Dahl' ) ;
928
921
929
- assert . deepStrictEqual ( obj1 , obj2 ) ;
922
+ assertDeepAndStrictEqual ( obj1 , obj2 ) ;
930
923
931
924
// Check extra properties on errors.
932
925
{
@@ -1047,7 +1040,7 @@ assert.throws(
1047
1040
Object . defineProperty ( a , 'getTime' , {
1048
1041
value : ( ) => 5
1049
1042
} ) ;
1050
- assert . deepStrictEqual ( a , b ) ;
1043
+ assertDeepAndStrictEqual ( a , b ) ;
1051
1044
}
1052
1045
1053
1046
// Verify that an array and the equivalent fake array object
@@ -1079,7 +1072,7 @@ assert.throws(
1079
1072
Object . defineProperty ( a , 'length' , {
1080
1073
value : 2
1081
1074
} ) ;
1082
- assert . notDeepStrictEqual ( a , [ 1 , 1 ] ) ;
1075
+ assertNotDeepOrStrict ( a , [ 1 , 1 ] ) ;
1083
1076
}
1084
1077
1085
1078
// Verify that changed tags will still check for the error message.
0 commit comments