builtin_set_test.go 342 B

1234567891011121314151617181920212223
  1. package goja
  2. import "testing"
  3. func TestSetEvilIterator(t *testing.T) {
  4. const SCRIPT = `
  5. var o = {};
  6. o[Symbol.iterator] = function() {
  7. return {
  8. next: function() {
  9. if (!this.flag) {
  10. this.flag = true;
  11. return {};
  12. }
  13. return {done: true};
  14. }
  15. }
  16. }
  17. new Set(o);
  18. undefined;
  19. `
  20. testScript1(SCRIPT, _undefined, t)
  21. }