computed-property-throws.js 459 B

12345678910111213141516171819
  1. test("Issue #3459, exception in computed property expression", () => {
  2. expect(() => {
  3. "foo"[bar];
  4. }).toThrow(ReferenceError);
  5. expect(() => {
  6. "foo"[bar]();
  7. }).toThrow(ReferenceError);
  8. });
  9. test("Issue #3941, exception in computed property's toString()", () => {
  10. expect(() => {
  11. const o = {
  12. toString() {
  13. throw Error();
  14. },
  15. };
  16. "foo"[o];
  17. }).toThrow(Error);
  18. });