import { DESCRIPTORS } from '../helpers/constants';

if (DESCRIPTORS) {
  QUnit.test('Function#name', assert => {
    assert.ok('name' in Function.prototype);
    assert.nonEnumerable(Function.prototype, 'name');
    function foo() { /* empty */ }
    assert.same(foo.name, 'foo');
    assert.same(function () { /* empty */ }.name, '');
    if (Object.freeze) {
      assert.same(Object.freeze(() => { /* empty */ }).name, '');
    }
    function bar() { /* empty */ }
    bar.toString = function () {
      throw new Error();
    };
    assert.notThrows(() => bar.name === 'bar', 'works with redefined `.toString`');
    const baz = Object(() => { /* empty */ });
    baz.toString = function () {
      return '';
    };
    assert.same(baz.name, '');
  });
}

@@ -745,16 +745,474 @@
 me, '');
+%0A%0A    assert.same(function /*%0A    multi-line comment */() %7B /* empty */ %7D.name, '');%0A%0A    function /*%0A    multi-line comment */%0A    foobar() %7B /* empty */ %7D%0A    assert.same(foobar.name, 'foobar');%0A%0A    function // simple-line comment%0A    foobaz() %7B /* empty */ %7D%0A    assert.same(foobaz.name, 'foobaz');%0A%0A    function // simple-line comment%0A    /* multi-line comment */quux/*%0A    multi-line comment%0A    */() %7B /* empty */ %7D%0A    assert.same(quux.name, 'quux');
 %0A  %7D);%0A%7D

add new test asserts for es.function.name.js