@@ -119,51 +119,51 @@ test('.not()', function (t) {
119
119
t . end ( ) ;
120
120
} ) ;
121
121
122
- test ( '.same ()' , function ( t ) {
122
+ test ( '.deepEqual ()' , function ( t ) {
123
123
t . doesNotThrow ( function ( ) {
124
- assert . same ( { a : 'a' } , { a : 'a' } ) ;
124
+ assert . deepEqual ( { a : 'a' } , { a : 'a' } ) ;
125
125
} ) ;
126
126
127
127
t . doesNotThrow ( function ( ) {
128
- assert . same ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
128
+ assert . deepEqual ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
129
129
} ) ;
130
130
131
131
t . throws ( function ( ) {
132
- assert . same ( { a : 'a' } , { a : 'b' } ) ;
132
+ assert . deepEqual ( { a : 'a' } , { a : 'b' } ) ;
133
133
} ) ;
134
134
135
135
t . throws ( function ( ) {
136
- assert . same ( [ 'a' , 'b' ] , [ 'a' , 'a' ] ) ;
136
+ assert . deepEqual ( [ 'a' , 'b' ] , [ 'a' , 'a' ] ) ;
137
137
} ) ;
138
138
139
139
t . throws ( function ( ) {
140
- assert . same ( [ [ 'a' , 'b' ] , 'c' ] , [ [ 'a' , 'b' ] , 'd' ] ) ;
140
+ assert . deepEqual ( [ [ 'a' , 'b' ] , 'c' ] , [ [ 'a' , 'b' ] , 'd' ] ) ;
141
141
} , / ' c ' ] .* ? ' d ' ] / ) ;
142
142
143
143
t . throws ( function ( ) {
144
144
var circular = [ 'a' , 'b' ] ;
145
145
circular . push ( circular ) ;
146
- assert . same ( [ circular , 'c' ] , [ circular , 'd' ] ) ;
146
+ assert . deepEqual ( [ circular , 'c' ] , [ circular , 'd' ] ) ;
147
147
} , / ' c ' ] .* ? ' d ' ] / ) ;
148
148
149
149
t . end ( ) ;
150
150
} ) ;
151
151
152
- test ( '.notSame ()' , function ( t ) {
152
+ test ( '.notDeepEqual ()' , function ( t ) {
153
153
t . doesNotThrow ( function ( ) {
154
- assert . notSame ( { a : 'a' } , { a : 'b' } ) ;
154
+ assert . notDeepEqual ( { a : 'a' } , { a : 'b' } ) ;
155
155
} ) ;
156
156
157
157
t . doesNotThrow ( function ( ) {
158
- assert . notSame ( [ 'a' , 'b' ] , [ 'c' , 'd' ] ) ;
158
+ assert . notDeepEqual ( [ 'a' , 'b' ] , [ 'c' , 'd' ] ) ;
159
159
} ) ;
160
160
161
161
t . throws ( function ( ) {
162
- assert . notSame ( { a : 'a' } , { a : 'a' } ) ;
162
+ assert . notDeepEqual ( { a : 'a' } , { a : 'a' } ) ;
163
163
} ) ;
164
164
165
165
t . throws ( function ( ) {
166
- assert . notSame ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
166
+ assert . notDeepEqual ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
167
167
} ) ;
168
168
169
169
t . end ( ) ;
@@ -259,7 +259,7 @@ test('.ifError()', function (t) {
259
259
t . end ( ) ;
260
260
} ) ;
261
261
262
- test ( '.same () should not mask RangeError from underlying assert' , function ( t ) {
262
+ test ( '.deepEqual () should not mask RangeError from underlying assert' , function ( t ) {
263
263
var Circular = function ( ) {
264
264
this . test = this ;
265
265
} ;
@@ -268,12 +268,46 @@ test('.same() should not mask RangeError from underlying assert', function (t) {
268
268
var b = new Circular ( ) ;
269
269
270
270
t . throws ( function ( ) {
271
- assert . notSame ( a , b ) ;
271
+ assert . notDeepEqual ( a , b ) ;
272
272
} ) ;
273
273
274
274
t . doesNotThrow ( function ( ) {
275
- assert . same ( a , b ) ;
275
+ assert . deepEqual ( a , b ) ;
276
276
} ) ;
277
277
278
278
t . end ( ) ;
279
279
} ) ;
280
+
281
+ test ( '.same() should log a deprecation notice' , function ( t ) {
282
+ var calledWith ;
283
+ var originalConsole = console . warn ;
284
+ console . warn = function ( ) {
285
+ calledWith = arguments ;
286
+ } ;
287
+
288
+ assert . same ( { } , { } ) ;
289
+
290
+ t . true ( calledWith [ 0 ] . indexOf ( 'DEPRECATION NOTICE' ) !== - 1 ) ;
291
+ t . true ( calledWith [ 0 ] . indexOf ( 'same()' ) !== - 1 ) ;
292
+ t . true ( calledWith [ 0 ] . indexOf ( 'deepEqual()' ) !== - 1 ) ;
293
+
294
+ console . warn = originalConsole ;
295
+ t . end ( ) ;
296
+ } ) ;
297
+
298
+ test ( '.notSame() should log a deprecation notice' , function ( t ) {
299
+ var calledWith ;
300
+ var originalConsole = console . warn ;
301
+ console . warn = function ( ) {
302
+ calledWith = arguments ;
303
+ } ;
304
+
305
+ assert . notSame ( { foo : 'bar' } , { bar : 'foo' } ) ;
306
+
307
+ t . true ( calledWith [ 0 ] . indexOf ( 'DEPRECATION NOTICE' ) !== - 1 ) ;
308
+ t . true ( calledWith [ 0 ] . indexOf ( 'notSame()' ) !== - 1 ) ;
309
+ t . true ( calledWith [ 0 ] . indexOf ( 'notDeepEqual()' ) !== - 1 ) ;
310
+
311
+ console . warn = originalConsole ;
312
+ t . end ( ) ;
313
+ } ) ;
0 commit comments