Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

test(rome_js_formatter): update prettier tests #3684

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
source: crates/rome_js_formatter/tests/prettier_tests.rs
info:
test_file: js/arrays/holes-in-args.js
---

# Input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
source: crates/rome_js_formatter/tests/prettier_tests.rs
info:
test_file: js/arrays/numbers-negative.js
---

# Input
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
x = (bifornCringerMoshedPerplexSawder) => ((askTrovenaBeenaDependsRowans, glimseGlyphsHazardNoopsTieTie) => (f00) => {
averredBathersBoxroomBuggyNurl();
} // BOOM
)

x2 = (a) => ((askTrovenaBeenaDependsRowans1, askTrovenaBeenaDependsRowans2, askTrovenaBeenaDependsRowans3) => {
c();
} /* ! */ // KABOOM
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
x =
(bifornCringerMoshedPerplexSawder) =>
(askTrovenaBeenaDependsRowans, glimseGlyphsHazardNoopsTieTie) =>
(f00) => {
averredBathersBoxroomBuggyNurl();
}; // BOOM

x2 =
(a) =>
(
askTrovenaBeenaDependsRowans1,
askTrovenaBeenaDependsRowans2,
askTrovenaBeenaDependsRowans3,
) => {
c();
} /* ! */; // KABOOM
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
(a => {}).length
typeof (() => {});
export default (() => {})();
(() => {})()``;
(() => {})``;
new (() => {});
if ((() => {}) ? 1 : 0) {}
let f = () => ({}())
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}`` && a);
a = () => ({} = 0);
a = () => ({}, a);
a => a instanceof {};
a => ({}().b && 0)
a => ({}().c = 0)
x => ({}()())
x => ({}()``)
x => ({}().b);
a = b => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
(a => ({})) || 0;
a = b => c;
a = b => {
return c
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
((a) => {}).length;
typeof (() => {});
export default (() => {})();
(() => {})()``;
(() => {})``;
new (() => {})();
if ((() => {}) ? 1 : 0) {
}
let f = () => ({}());
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}`` && a);
a = () => ({} = 0);
a = () => ({}, a);
(a) => a instanceof {};
(a) => ({}().b && 0);
(a) => ({}().c = 0);
(x) => ({}()());
(x) => ({}()``);
(x) => ({}().b);
a = (b) => c;
(x) => (y = z);
(x) => (y += z);
f((a) => ({})) + 1;
((a) => ({})) || 0;
a = (b) => c;
a = (b) => {
return c;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
source: crates/rome_js_formatter/tests/prettier_tests.rs
info:
test_file: js/arrows/arrow_function_expression.js
---

# Input

```js
(a => {}).length
typeof (() => {});
export default (() => {})();
(() => {})()``;
(() => {})``;
new (() => {});
if ((() => {}) ? 1 : 0) {}
let f = () => ({}())
let a = () => ({} instanceof a);
a = () => ({} && a);
a = () => ({}() && a);
a = () => ({} && a && b);
a = () => ({} + a);
a = () => ({}()() && a);
a = () => ({}.b && a);
a = () => ({}[b] && a);
a = () => ({}`` && a);
a = () => ({} = 0);
a = () => ({}, a);
a => a instanceof {};
a => ({}().b && 0)
a => ({}().c = 0)
x => ({}()())
x => ({}()``)
x => ({}().b);
a = b => c;
x => (y = z);
x => (y += z);
f(a => ({})) + 1;
(a => ({})) || 0;
a = b => c;
a = b => {
return c
};
```


# Prettier differences

```diff
--- Prettier
+++ Rome
@@ -6,24 +6,24 @@
new (() => {})();
if ((() => {}) ? 1 : 0) {
}
-let f = () => ({}());
-let a = () => ({} instanceof a);
-a = () => ({} && a);
-a = () => ({}() && a);
-a = () => ({} && a && b);
-a = () => ({} + a);
-a = () => ({}()() && a);
-a = () => ({}.b && a);
-a = () => ({}[b] && a);
-a = () => ({}`` && a);
+let f = () => ({})();
+let a = () => ({}) instanceof a;
+a = () => ({}) && a;
+a = () => ({})() && a;
+a = () => ({}) && a && b;
+a = () => ({}) + a;
+a = () => ({})()() && a;
+a = () => ({}).b && a;
+a = () => ({})[b] && a;
+a = () => ({})`` && a;
a = () => ({} = 0);
-a = () => ({}, a);
+a = () => (({}), a);
(a) => a instanceof {};
-(a) => ({}().b && 0);
-(a) => ({}().c = 0);
-(x) => ({}()());
-(x) => ({}()``);
-(x) => ({}().b);
+(a) => ({})().b && 0;
+(a) => (({})().c = 0);
+(x) => ({})()();
+(x) => ({})()``;
+(x) => ({})().b;
a = (b) => c;
(x) => (y = z);
(x) => (y += z);
```

# Output

```js
((a) => {}).length;
typeof (() => {});
export default (() => {})();
(() => {})()``;
(() => {})``;
new (() => {})();
if ((() => {}) ? 1 : 0) {
}
let f = () => ({})();
let a = () => ({}) instanceof a;
a = () => ({}) && a;
a = () => ({})() && a;
a = () => ({}) && a && b;
a = () => ({}) + a;
a = () => ({})()() && a;
a = () => ({}).b && a;
a = () => ({})[b] && a;
a = () => ({})`` && a;
a = () => ({} = 0);
a = () => (({}), a);
(a) => a instanceof {};
(a) => ({})().b && 0;
(a) => (({})().c = 0);
(x) => ({})()();
(x) => ({})()``;
(x) => ({})().b;
a = (b) => c;
(x) => (y = z);
(x) => (y += z);
f((a) => ({})) + 1;
((a) => ({})) || 0;
a = (b) => c;
a = (b) => {
return c;
};
```



Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
bifornCringer = askTrovenaBeenaDepends = glimseGlyphs = (
argumentOne,
argumentTwo,
) => restOfTheArguments12345678 => {
return "baz";
};

bifornCringer = askTrovenaBeenaDepends = glimseGlyphs = (
argumentOne,
argumentTwo,
argumentThree
) => restOfTheArguments12345678 => {
return "baz";
};

bifornCringer = askTrovenaBeenaDepends = glimseGlyphs = (
argumentOne,
argumentTwo,
argumentThree
) => {
return "baz";
};

const bifornCringer1 =
askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo) => (restOfTheArguments12345678) => {
return "baz";
};

const bifornCringer2 =
askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo, argumentThree) =>
(restOfTheArguments12345678) => {
return "baz";
};

const bifornCringer3 =
askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo, argumentThree) => {
return "baz";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
bifornCringer =
askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo) => (restOfTheArguments12345678) => {
return "baz";
};

bifornCringer =
askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo, argumentThree) =>
(restOfTheArguments12345678) => {
return "baz";
};

bifornCringer =
askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo, argumentThree) => {
return "baz";
};

const bifornCringer1 =
(askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo) => (restOfTheArguments12345678) => {
return "baz";
});

const bifornCringer2 =
(askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo, argumentThree) =>
(restOfTheArguments12345678) => {
return "baz";
});

const bifornCringer3 =
(askTrovenaBeenaDepends =
glimseGlyphs =
(argumentOne, argumentTwo, argumentThree) => {
return "baz";
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a = () => ({} = this);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a = () => ({} = this);
Loading