@@ -84,15 +84,112 @@ tap.test('failures', function (tt) {
84
84
'ok ' + ++ count + ' unexpected error' ,
85
85
'# throwing primitives' ,
86
86
'ok ' + ++ count + ' primitive: null, no expected' ,
87
+ 'not ok ' + ++ count + ' primitive: null, with non-empty expected object' ,
88
+ ' ---' ,
89
+ ' operator: throws' ,
90
+ ' expected: |-' ,
91
+ ' { a: \'b\' }' ,
92
+ ' actual: |-' ,
93
+ ' null' ,
94
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
95
+ ' ...' ,
87
96
'ok ' + ++ count + ' primitive: undefined, no expected' ,
97
+ 'not ok ' + ++ count + ' primitive: undefined, with non-empty expected object' ,
98
+ ' ---' ,
99
+ ' operator: throws' ,
100
+ ' expected: |-' ,
101
+ ' { a: \'b\' }' ,
102
+ ' actual: |-' ,
103
+ ' undefined' ,
104
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
105
+ ' stack: |-' ,
106
+ ' Error: primitive: undefined, with non-empty expected object' ,
107
+ ' [... stack stripped ...]' ,
108
+ ' at $TEST/throws.js:$LINE:$COL' ,
109
+ ' [... stack stripped ...]' ,
110
+ ' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)' ,
111
+ ' [... stack stripped ...]' ,
112
+ ' ...' ,
88
113
'ok ' + ++ count + ' primitive: 0, no expected' ,
114
+ 'not ok ' + ++ count + ' primitive: 0, with non-empty expected object' ,
115
+ ' ---' ,
116
+ ' operator: throws' ,
117
+ ' expected: |-' ,
118
+ ' { a: \'b\' }' ,
119
+ ' actual: |-' ,
120
+ ' 0' ,
121
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
122
+ ' ...' ,
89
123
'ok ' + ++ count + ' primitive: NaN, no expected' ,
124
+ 'not ok ' + ++ count + ' primitive: NaN, with non-empty expected object' ,
125
+ ' ---' ,
126
+ ' operator: throws' ,
127
+ ' expected: |-' ,
128
+ ' { a: \'b\' }' ,
129
+ ' actual: |-' ,
130
+ ' NaN' ,
131
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
132
+ ' ...' ,
90
133
'ok ' + ++ count + ' primitive: 42, no expected' ,
134
+ 'not ok ' + ++ count + ' primitive: 42, with non-empty expected object' ,
135
+ ' ---' ,
136
+ ' operator: throws' ,
137
+ ' expected: |-' ,
138
+ ' { a: \'b\' }' ,
139
+ ' actual: |-' ,
140
+ ' 42' ,
141
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
142
+ ' ...' ,
91
143
'ok ' + ++ count + ' primitive: Infinity, no expected' ,
144
+ 'not ok ' + ++ count + ' primitive: Infinity, with non-empty expected object' ,
145
+ ' ---' ,
146
+ ' operator: throws' ,
147
+ ' expected: |-' ,
148
+ ' { a: \'b\' }' ,
149
+ ' actual: |-' ,
150
+ ' Infinity' ,
151
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
152
+ ' ...' ,
92
153
'ok ' + ++ count + ' primitive: \'\', no expected' ,
154
+ 'not ok ' + ++ count + ' primitive: \'\', with non-empty expected object' ,
155
+ ' ---' ,
156
+ ' operator: throws' ,
157
+ ' expected: |-' ,
158
+ ' { a: \'b\' }' ,
159
+ ' actual: |-' ,
160
+ ' \'\'' ,
161
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
162
+ ' ...' ,
93
163
'ok ' + ++ count + ' primitive: \'foo\', no expected' ,
164
+ 'not ok ' + ++ count + ' primitive: \'foo\', with non-empty expected object' ,
165
+ ' ---' ,
166
+ ' operator: throws' ,
167
+ ' expected: |-' ,
168
+ ' { a: \'b\' }' ,
169
+ ' actual: |-' ,
170
+ ' \'foo\'' ,
171
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
172
+ ' ...' ,
94
173
'ok ' + ++ count + ' primitive: true, no expected' ,
174
+ 'not ok ' + ++ count + ' primitive: true, with non-empty expected object' ,
175
+ ' ---' ,
176
+ ' operator: throws' ,
177
+ ' expected: |-' ,
178
+ ' { a: \'b\' }' ,
179
+ ' actual: |-' ,
180
+ ' true' ,
181
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
182
+ ' ...' ,
95
183
'ok ' + ++ count + ' primitive: false, no expected' ,
184
+ 'not ok ' + ++ count + ' primitive: false, with non-empty expected object' ,
185
+ ' ---' ,
186
+ ' operator: throws' ,
187
+ ' expected: |-' ,
188
+ ' { a: \'b\' }' ,
189
+ ' actual: |-' ,
190
+ ' false' ,
191
+ ' at: <anonymous> ($TEST/throws.js:$LINE:$COL)' ,
192
+ ' ...' ,
96
193
'# ambiguous arguments' ,
97
194
'ok ' + ++ count + ' Second' ,
98
195
'ok ' + ++ count + ' Second' ,
@@ -283,6 +380,7 @@ tap.test('failures', function (tt) {
283
380
test ( 'throwing primitives' , function ( t ) {
284
381
[ null , undefined , 0 , NaN , 42 , Infinity , '' , 'foo' , true , false ] . forEach ( function ( primitive ) {
285
382
t . throws ( function ( ) { throw primitive ; } , 'primitive: ' + inspect ( primitive ) + ', no expected' ) ;
383
+ t . throws ( function ( ) { throw primitive ; } , { a : 'b' } , 'primitive: ' + inspect ( primitive ) + ', with non-empty expected object' ) ;
286
384
} ) ;
287
385
288
386
t . end ( ) ;
0 commit comments