Skip to content

test(oxc_linter): add testing for code fixer#101

Merged
Boshen merged 10 commits intomainfrom
test/code-fixer
Mar 4, 2023
Merged

test(oxc_linter): add testing for code fixer#101
Boshen merged 10 commits intomainfrom
test/code-fixer

Conversation

@jason89521
Copy link
Contributor

@jason89521 jason89521 commented Mar 3, 2023

Description

Add insertion testing for our code fixer, the test cases are copied from eslint's test cases. The other test cases will be added in the other pr, otherwise this pr would be too big to review.

Store &'a str in Fixer instead of String.

To avoid overriding the previous fix, we need to record the position of the last fix. As a result, instead of using Fix::apply, I move the fixing code into the Fixer::fix method.

Related issues

#68

@Boshen
Copy link
Member

Boshen commented Mar 3, 2023

You can keep working on the test cases, we don't need to merge right away.

@Boshen Boshen marked this pull request as draft March 3, 2023 15:06
Copy link
Contributor

@shannonrothe shannonrothe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tests – this looks good!

@jason89521
Copy link
Contributor Author

@Boshen eslint's test cases contain "message", "no fix", "BOM handle", would you like me test all these cases in this pr or in other pr?

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2023

Parser Benchmark Results - ubuntu-latest

group                    main                                   pr
-----                    ----                                   --
parser/babylon.max.js    1.00    119.5±0.30ms    86.4 MB/sec    1.01    120.8±0.39ms    85.5 MB/sec
parser/d3.js             1.00     14.6±0.03ms    37.5 MB/sec    1.01     14.8±0.03ms    37.0 MB/sec
parser/lodash.js         1.00      4.2±0.10ms   123.1 MB/sec    1.01      4.2±0.09ms   121.5 MB/sec
parser/pdf.js            1.00      8.4±0.03ms    48.1 MB/sec    1.00      8.4±0.03ms    48.0 MB/sec
parser/typescript.js     1.00    120.1±0.29ms    80.1 MB/sec    1.01    121.4±0.36ms    79.3 MB/sec

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2023

Parser Benchmark Results - macos-latest

group                    main                                   pr
-----                    ----                                   --
parser/babylon.max.js    1.02    149.0±3.01ms    69.3 MB/sec    1.00    146.0±2.92ms    70.7 MB/sec
parser/d3.js             1.00     17.2±0.35ms    31.7 MB/sec    1.02     17.7±0.32ms    30.9 MB/sec
parser/lodash.js         1.00      4.8±0.27ms   106.5 MB/sec    1.02      4.9±0.24ms   104.8 MB/sec
parser/pdf.js            1.00     10.0±0.24ms    40.1 MB/sec    1.02     10.2±0.29ms    39.3 MB/sec
parser/typescript.js     1.01    147.7±4.17ms    65.1 MB/sec    1.00    145.8±5.42ms    66.0 MB/sec

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2023

Parser Benchmark Results - windows-latest

group                    main                                   pr
-----                    ----                                   --
parser/babylon.max.js    1.00    167.5±3.93ms    61.7 MB/sec    1.01   169.4±12.92ms    60.9 MB/sec
parser/d3.js             1.00     20.2±0.42ms    27.0 MB/sec    1.01     20.5±0.78ms    26.6 MB/sec
parser/lodash.js         1.00      5.7±0.23ms    90.1 MB/sec    1.00      5.7±0.29ms    89.8 MB/sec
parser/pdf.js            1.00     11.5±0.29ms    34.8 MB/sec    1.00     11.6±0.33ms    34.7 MB/sec
parser/typescript.js     1.00    166.1±3.55ms    57.9 MB/sec    1.00    166.8±4.84ms    57.7 MB/sec

@Boshen
Copy link
Member

Boshen commented Mar 4, 2023

eslint's test cases contain "message", "no fix", "BOM handle", would you like me test all these cases in this pr or in other pr?

It would be nice if we add these tests but #[ignore] them, since it's a bit troublesome to figure out what the missing tests are for the next person.

@jason89521
Copy link
Contributor Author

It would be nice if we add these tests but #[ignore] them, since it's a bit troublesome to figure out what the missing tests are for the next person.

Not sure whether c92e505 is what you want.

@Boshen Boshen marked this pull request as ready for review March 4, 2023 05:35
@Boshen Boshen merged commit 91c0163 into main Mar 4, 2023
@Boshen Boshen deleted the test/code-fixer branch March 4, 2023 05:37
@Boshen
Copy link
Member

Boshen commented Mar 4, 2023

Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants