[webkit-changes] [WebKit/WebKit] c57844: [JSC] Use for-of instead of for-in in stress tests...

SUZUKI Sosuke noreply at github.com
Wed Aug 14 18:47:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5784413c9600f6135b620857ae987b1d7b8cf87
      https://github.com/WebKit/WebKit/commit/c5784413c9600f6135b620857ae987b1d7b8cf87
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2024-08-14 (Wed, 14 Aug 2024)

  Changed paths:
    M JSTests/stress/temporal-duration.js

  Log Message:
  -----------
  [JSC] Use for-of instead of for-in in stress tests for Temporal.Duration
https://bugs.webkit.org/show_bug.cgi?id=278070

Reviewed by Yusuke Suzuki.

In `stress/temporal-duration.js`, a `for-in` loop is used as follows:

    const badStrings = [
        '', '+', '+P', '-P', '+-P',
        'P', 'P1', 'PT', 'P1YT', 'PT1',
        'PT20.S', 'PT.20S',
        'P1W1Y',  'PT1S1M',
        'P1.1Y', 'PT1.1H1M', 'PT1.1M1S',
        'PT1.1111111111H', 'PT1.1111111111M', 'PT1.1111111111S',
        `P${Array(309).fill(9).join('')}Y`
    ];
    for (const badString in badStrings)
        shouldThrow(() => Temporal.Duration.from(badString), RangeError);

Since `badString` becomes the index of the array, this test will pass regardless of the values.

This patch changes the loop to use `for-of` instead of `for-in`.

* JSTests/stress/temporal-duration.js:
(shouldThrow.Temporal.Duration.from):

Canonical link: https://commits.webkit.org/282271@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list