@@ -43,6 +43,12 @@ tap.test('intercept: output', function (tt) {
43
43
'ok ' + ++ count + ' undefined is returned from Get with .call' ,
44
44
'ok ' + ++ count + ' foo2: nonwritable property throws on Set' ,
45
45
'ok ' + ++ count + ' undefined is still returned from Get' ,
46
+ v . hasSymbols ? [
47
+ 'ok ' + ++ count + ' nonwritable Symbol property throws on Set' ,
48
+ 'ok ' + ++ count + ' undefined is still returned from Get of a Symbol'
49
+ ] : [
50
+ 'ok ' + ++ count + ' undefined is still returned from Get of a Symbol # SKIP no Symbol support'
51
+ ] ,
46
52
'ok ' + ++ count + ' throwing get implementation throws' ,
47
53
'ok ' + ++ count + ' throwing get implementation throws with .call' ,
48
54
'ok ' + ++ count + ' throwing set implementation throws' ,
@@ -166,6 +172,25 @@ tap.test('intercept: output', function (tt) {
166
172
st . equal ( o . foo2 , undefined , 'undefined is still returned from Get' ) ;
167
173
results2 . restore ( ) ;
168
174
175
+ if ( v . hasSymbols ) {
176
+ var sym = Symbol ( 'fooSymbol' ) ;
177
+ var resultsSymbol = st . intercept (
178
+ o ,
179
+ sym ,
180
+ { __proto__ : null , writable : false } ,
181
+ true
182
+ ) ;
183
+ st . throws (
184
+ function ( ) { o [ sym ] = 42 ; } ,
185
+ new RegExp ( '^TypeError: Cannot assign to read only property `Symbol\\(fooSymbol\\)` of object `' + inspect ( o ) + '`$' ) ,
186
+ 'nonwritable Symbol property throws on Set'
187
+ ) ;
188
+ st . equal ( o [ sym ] , undefined , 'undefined is still returned from Get of a Symbol' ) ;
189
+ resultsSymbol . restore ( ) ;
190
+ } else {
191
+ st . equal ( undefined , undefined , 'undefined is still returned from Get of a Symbol' , { skip : 'no Symbol support' } ) ;
192
+ }
193
+
169
194
var resultsThrowGet = st . intercept ( o , 'fooThrowGet' , { get : function ( ) { throw up ; } } ) ;
170
195
st . throws (
171
196
function ( ) { return o . fooThrowGet ; } ,
0 commit comments