This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(rome_js_formatter): update prettier tests (#4104)
- Loading branch information
Showing
40 changed files
with
540 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
crates/rome_js_formatter/tests/specs/prettier/js/arrays/issue-10159.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
source: crates/rome_formatter_test/src/snapshot_builder.rs | ||
info: js/arrays/issue-10159.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
{for (const srcPath of [src, `${src}.js`, `${src}/index`, `${src}/index.js`]) {}} | ||
{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_43]) {}} | ||
{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_432]) {}} | ||
{for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_4321]) {}} | ||
|
||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -7,7 +7,9 @@ | ||
} | ||
} | ||
{ | ||
- for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_432]) { | ||
+ for (const srcPath of [ | ||
+ 123, 123_123_123, 123_123_123_1, 13_123_3123_31_432, | ||
+ ]) { | ||
} | ||
} | ||
{ | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
{ | ||
for (const srcPath of [src, `${src}.js`, `${src}/index`, `${src}/index.js`]) { | ||
} | ||
} | ||
{ | ||
for (const srcPath of [123, 123_123_123, 123_123_123_1, 13_123_3123_31_43]) { | ||
} | ||
} | ||
{ | ||
for (const srcPath of [ | ||
123, 123_123_123, 123_123_123_1, 13_123_3123_31_432, | ||
]) { | ||
} | ||
} | ||
{ | ||
for (const srcPath of [ | ||
123, 123_123_123, 123_123_123_1, 13_123_3123_31_4321, | ||
]) { | ||
} | ||
} | ||
``` | ||
|
||
|
9 changes: 9 additions & 0 deletions
9
crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/async.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
async; | ||
foo() {}; | ||
} | ||
|
||
class B { | ||
async = 1; | ||
foo() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
...rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/async.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
async; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
async = 1; | ||
foo() {} | ||
} |
98 changes: 98 additions & 0 deletions
98
crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/async.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
source: crates/rome_formatter_test/src/snapshot_builder.rs | ||
info: js/classes/keyword-property/async.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
class A { | ||
async; | ||
foo() {}; | ||
} | ||
|
||
class B { | ||
async = 1; | ||
foo() {} | ||
} | ||
|
||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -1,9 +1,10 @@ | ||
class A { | ||
- async; | ||
+ async | ||
foo() {} | ||
} | ||
|
||
class B { | ||
- async = 1; | ||
+ async | ||
+ = 1 | ||
foo() {} | ||
} | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
class A { | ||
async | ||
foo() {} | ||
} | ||
|
||
class B { | ||
async | ||
= 1 | ||
foo() {} | ||
} | ||
``` | ||
|
||
# Errors | ||
``` | ||
async.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found ';' | ||
1 │ class A { | ||
> 2 │ async; | ||
│ ^ | ||
3 │ foo() {}; | ||
4 │ } | ||
i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here | ||
1 │ class A { | ||
> 2 │ async; | ||
│ ^ | ||
3 │ foo() {}; | ||
4 │ } | ||
async.js:7:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '=' | ||
6 │ class B { | ||
> 7 │ async = 1; | ||
│ ^ | ||
8 │ foo() {} | ||
9 │ } | ||
i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here | ||
6 │ class B { | ||
> 7 │ async = 1; | ||
│ ^ | ||
8 │ foo() {} | ||
9 │ } | ||
``` | ||
|
||
|
9 changes: 9 additions & 0 deletions
9
crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/get.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
get; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
get = 1; | ||
foo() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
...s/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/get.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
get; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
get = 1; | ||
foo() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/set.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
set; | ||
foo(v) {} | ||
} | ||
|
||
class B { | ||
set = 1; | ||
foo(v) {} | ||
} |
9 changes: 9 additions & 0 deletions
9
...s/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/set.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
set; | ||
foo(v) {} | ||
} | ||
|
||
class B { | ||
set = 1; | ||
foo(v) {} | ||
} |
9 changes: 9 additions & 0 deletions
9
crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/static-async.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
static async; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
static async = 1; | ||
foo() {} | ||
} |
9 changes: 9 additions & 0 deletions
9
..._formatter/tests/specs/prettier/js/classes/keyword-property/static-async.js.prettier-snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
static async; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
static async = 1; | ||
foo() {} | ||
} |
98 changes: 98 additions & 0 deletions
98
...s/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/static-async.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
source: crates/rome_formatter_test/src/snapshot_builder.rs | ||
info: js/classes/keyword-property/static-async.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
class A { | ||
static async; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
static async = 1; | ||
foo() {} | ||
} | ||
|
||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -1,9 +1,10 @@ | ||
class A { | ||
- static async; | ||
+ static async | ||
foo() {} | ||
} | ||
|
||
class B { | ||
- static async = 1; | ||
+ static async | ||
+ = 1 | ||
foo() {} | ||
} | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
class A { | ||
static async | ||
foo() {} | ||
} | ||
|
||
class B { | ||
static async | ||
= 1 | ||
foo() {} | ||
} | ||
``` | ||
|
||
# Errors | ||
``` | ||
static-async.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found ';' | ||
1 │ class A { | ||
> 2 │ static async; | ||
│ ^ | ||
3 │ foo() {} | ||
4 │ } | ||
i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here | ||
1 │ class A { | ||
> 2 │ static async; | ||
│ ^ | ||
3 │ foo() {} | ||
4 │ } | ||
static-async.js:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
× expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '=' | ||
6 │ class B { | ||
> 7 │ static async = 1; | ||
│ ^ | ||
8 │ foo() {} | ||
9 │ } | ||
i Expected an identifier, a string literal, a number literal, a private field name, or a computed name here | ||
6 │ class B { | ||
> 7 │ static async = 1; | ||
│ ^ | ||
8 │ foo() {} | ||
9 │ } | ||
``` | ||
|
||
|
9 changes: 9 additions & 0 deletions
9
crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/static-get.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A { | ||
static get; | ||
foo() {} | ||
} | ||
|
||
class B { | ||
static get = 1; | ||
foo() {} | ||
} |
Oops, something went wrong.