@@ -3011,3 +3011,35 @@ assert.strictEqual(
3011
3011
'}'
3012
3012
) ;
3013
3013
}
3014
+
3015
+ {
3016
+ // Confirm null prototype of generator prototype displays as expected.
3017
+
3018
+ function getProtoOfProto ( ) {
3019
+ return Object . getPrototypeOf ( Object . getPrototypeOf ( function * ( ) { } ) ) ;
3020
+ }
3021
+
3022
+ function * generator ( ) { }
3023
+
3024
+ const generatorPrototype = Object . getPrototypeOf ( generator ) ;
3025
+ const originalProtoOfProto = Object . getPrototypeOf ( generatorPrototype ) ;
3026
+ assert . strictEqual ( getProtoOfProto ( ) , originalProtoOfProto ) ;
3027
+ Object . setPrototypeOf ( generatorPrototype , null ) ;
3028
+ assert . notStrictEqual ( getProtoOfProto , originalProtoOfProto ) ;
3029
+
3030
+ // This is the actual test. The other assertions in this block are about
3031
+ // making sure the test is set up correctly and isn't polluting other tests.
3032
+ assert . strictEqual (
3033
+ util . inspect ( generator , { showHidden : true } ) ,
3034
+ '[GeneratorFunction: generator] {\n' +
3035
+ ' [length]: 0,\n' +
3036
+ " [name]: 'generator',\n" +
3037
+ " [prototype]: Object [Generator] { [Symbol(Symbol.toStringTag)]: 'Generator' },\n" + // eslint-disable-line max-len
3038
+ " [Symbol(Symbol.toStringTag)]: 'GeneratorFunction'\n" +
3039
+ '}'
3040
+ ) ;
3041
+
3042
+ // Reset so we don't pollute other tests
3043
+ Object . setPrototypeOf ( generatorPrototype , originalProtoOfProto ) ;
3044
+ assert . strictEqual ( getProtoOfProto ( ) , originalProtoOfProto ) ;
3045
+ }
0 commit comments