@@ -119,51 +119,51 @@ test('.not()', function (t) {
119119 t . end ( ) ;
120120} ) ;
121121
122- test ( '.same ()' , function ( t ) {
122+ test ( '.deepEqual ()' , function ( t ) {
123123 t . doesNotThrow ( function ( ) {
124- assert . same ( { a : 'a' } , { a : 'a' } ) ;
124+ assert . deepEqual ( { a : 'a' } , { a : 'a' } ) ;
125125 } ) ;
126126
127127 t . doesNotThrow ( function ( ) {
128- assert . same ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
128+ assert . deepEqual ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
129129 } ) ;
130130
131131 t . throws ( function ( ) {
132- assert . same ( { a : 'a' } , { a : 'b' } ) ;
132+ assert . deepEqual ( { a : 'a' } , { a : 'b' } ) ;
133133 } ) ;
134134
135135 t . throws ( function ( ) {
136- assert . same ( [ 'a' , 'b' ] , [ 'a' , 'a' ] ) ;
136+ assert . deepEqual ( [ 'a' , 'b' ] , [ 'a' , 'a' ] ) ;
137137 } ) ;
138138
139139 t . throws ( function ( ) {
140- assert . same ( [ [ 'a' , 'b' ] , 'c' ] , [ [ 'a' , 'b' ] , 'd' ] ) ;
140+ assert . deepEqual ( [ [ 'a' , 'b' ] , 'c' ] , [ [ 'a' , 'b' ] , 'd' ] ) ;
141141 } , / ' c ' ] .* ? ' d ' ] / ) ;
142142
143143 t . throws ( function ( ) {
144144 var circular = [ 'a' , 'b' ] ;
145145 circular . push ( circular ) ;
146- assert . same ( [ circular , 'c' ] , [ circular , 'd' ] ) ;
146+ assert . deepEqual ( [ circular , 'c' ] , [ circular , 'd' ] ) ;
147147 } , / ' c ' ] .* ? ' d ' ] / ) ;
148148
149149 t . end ( ) ;
150150} ) ;
151151
152- test ( '.notSame ()' , function ( t ) {
152+ test ( '.notDeepEqual ()' , function ( t ) {
153153 t . doesNotThrow ( function ( ) {
154- assert . notSame ( { a : 'a' } , { a : 'b' } ) ;
154+ assert . notDeepEqual ( { a : 'a' } , { a : 'b' } ) ;
155155 } ) ;
156156
157157 t . doesNotThrow ( function ( ) {
158- assert . notSame ( [ 'a' , 'b' ] , [ 'c' , 'd' ] ) ;
158+ assert . notDeepEqual ( [ 'a' , 'b' ] , [ 'c' , 'd' ] ) ;
159159 } ) ;
160160
161161 t . throws ( function ( ) {
162- assert . notSame ( { a : 'a' } , { a : 'a' } ) ;
162+ assert . notDeepEqual ( { a : 'a' } , { a : 'a' } ) ;
163163 } ) ;
164164
165165 t . throws ( function ( ) {
166- assert . notSame ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
166+ assert . notDeepEqual ( [ 'a' , 'b' ] , [ 'a' , 'b' ] ) ;
167167 } ) ;
168168
169169 t . end ( ) ;
@@ -259,7 +259,7 @@ test('.ifError()', function (t) {
259259 t . end ( ) ;
260260} ) ;
261261
262- test ( '.same () should not mask RangeError from underlying assert' , function ( t ) {
262+ test ( '.deepEqual () should not mask RangeError from underlying assert' , function ( t ) {
263263 var Circular = function ( ) {
264264 this . test = this ;
265265 } ;
@@ -268,12 +268,46 @@ test('.same() should not mask RangeError from underlying assert', function (t) {
268268 var b = new Circular ( ) ;
269269
270270 t . throws ( function ( ) {
271- assert . notSame ( a , b ) ;
271+ assert . notDeepEqual ( a , b ) ;
272272 } ) ;
273273
274274 t . doesNotThrow ( function ( ) {
275- assert . same ( a , b ) ;
275+ assert . deepEqual ( a , b ) ;
276276 } ) ;
277277
278278 t . end ( ) ;
279279} ) ;
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