@@ -120,6 +120,88 @@ test('.not()', function (t) {
120
120
} ) ;
121
121
122
122
test ( '.deepEqual()' , function ( t ) {
123
+ // Tests starting here are to detect regressions in the underlying libraries
124
+ // used to test deep object equality
125
+
126
+ t . throws ( function ( ) {
127
+ assert . deepEqual ( { a : false } , { a : 0 } ) ;
128
+ } ) ;
129
+
130
+ t . doesNotThrow ( function ( ) {
131
+ assert . deepEqual ( { a : 'a' , b : 'b' } , { b : 'b' , a : 'a' } ) ;
132
+ } ) ;
133
+
134
+ t . doesNotThrow ( function ( ) {
135
+ assert . deepEqual ( { a : 'a' , b : 'b' , c : { d : 'd' } } , { c : { d : 'd' } , b : 'b' , a : 'a' } ) ;
136
+ } ) ;
137
+
138
+ t . throws ( function ( ) {
139
+ assert . deepEqual ( [ 1 , 2 , 3 ] , [ 1 , 2 , 3 , 4 ] ) ;
140
+ } ) ;
141
+
142
+ t . doesNotThrow ( function ( ) {
143
+ assert . deepEqual ( [ 1 , 2 , 3 ] , [ 1 , 2 , 3 ] ) ;
144
+ } ) ;
145
+
146
+ t . throws ( function ( ) {
147
+ assert . deepEqual ( [ 1 , 2 , 3 ] , [ 1 , 2 , 3 , 4 ] ) ;
148
+ } ) ;
149
+
150
+ t . throws ( function ( ) {
151
+ var fnA = function ( a ) {
152
+ return a ;
153
+ } ;
154
+ var fnB = function ( a ) {
155
+ return a ;
156
+ } ;
157
+
158
+ assert . deepEqual ( fnA , fnB ) ;
159
+ } ) ;
160
+
161
+ t . doesNotThrow ( function ( ) {
162
+ var x1 = { z : 4 } ;
163
+ var y1 = { x : x1 } ;
164
+ x1 . y = y1 ;
165
+
166
+ var x2 = { z : 4 } ;
167
+ var y2 = { x : x2 } ;
168
+ x2 . y = y2 ;
169
+
170
+ assert . deepEqual ( x1 , x2 ) ;
171
+ } ) ;
172
+
173
+ t . doesNotThrow ( function ( ) {
174
+ function Foo ( a ) {
175
+ this . a = a ;
176
+ }
177
+
178
+ var x = new Foo ( 1 ) ;
179
+ var y = new Foo ( 1 ) ;
180
+
181
+ assert . deepEqual ( x , y ) ;
182
+ } ) ;
183
+
184
+ t . doesNotThrow ( function ( ) {
185
+ function Foo ( a ) {
186
+ this . a = a ;
187
+ }
188
+
189
+ function Bar ( a ) {
190
+ this . a = a ;
191
+ }
192
+
193
+ var x = new Foo ( 1 ) ;
194
+ var y = new Bar ( 1 ) ;
195
+
196
+ assert . deepEqual ( x , y ) ;
197
+ } ) ;
198
+
199
+ t . throws ( function ( ) {
200
+ assert . deepEqual ( { a : 'a' , b : 'b' , c : { d : false } } , { c : { d : 0 } , b : 'b' , a : 'a' } ) ;
201
+ } ) ;
202
+
203
+ // Regression test end here
204
+
123
205
t . doesNotThrow ( function ( ) {
124
206
assert . deepEqual ( { a : 'a' } , { a : 'a' } ) ;
125
207
} ) ;
0 commit comments