Refactor BindExpression test (#19759)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-07-31 18:27:43 +08:00
1 parent 4f4d1979dd
commit 60f03eae59
7 files changed
+61 -640

No files matched your search

@@ -1,78 +1,5 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`await.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
const doBothThings = async () => {
const request = doAsyncThing();
return (await request)::doSyncThing();
};
=====================================output=====================================
const doBothThings = async () => {
const request = doAsyncThing()
return (await request)::doSyncThing()
}
================================================================================
`;
exports[`await.js - {"semi":false} format[acorn] 1`] = `
"Unexpected token (3:27)
1 | const doBothThings = async () => {
2 | const request = doAsyncThing();
> 3 | return (await request)::doSyncThing();
| ^
4 | };
5 |
Cause: Unexpected token (3:26)"
`;
exports[`await.js - {"semi":false} format[espree] 1`] = `
"Unexpected token : (3:27)
1 | const doBothThings = async () => {
2 | const request = doAsyncThing();
> 3 | return (await request)::doSyncThing();
| ^
4 | };
5 |
Cause: Unexpected token :"
`;
exports[`await.js - {"semi":false} format[meriyah] 1`] = `
"Unexpected token: ':' (3:27)
1 | const doBothThings = async () => {
2 | const request = doAsyncThing();
> 3 | return (await request)::doSyncThing();
| ^
4 | };
5 |
Cause: [3:26-3:27]: Unexpected token: ':'"
`;
exports[`await.js - {"semi":false} format[oxc] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found none (3:27)
1 | const doBothThings = async () => {
2 | const request = doAsyncThing();
> 3 | return (await request)::doSyncThing();
| ^
4 | };
5 |"
`;
exports[`await.js - {"semi":false} format[yuku] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found ':' (3:27)
1 | const doBothThings = async () => {
2 | const request = doAsyncThing();
> 3 | return (await request)::doSyncThing();
| ^
4 | };
5 |"
`;
exports[`await.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -145,142 +72,6 @@ exports[`await.js format[yuku] 1`] = `
5 |"
`;
exports[`bind_parens.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
(a || b)::c;
a || (b::c);
::obj.prop;
(void 0)::func();
(+0)::is(-0);
a::(b.c);
a::(b.c());
a::b.c();
a::(b.c()());
a::((b.c())());
a::(b.c())();
a::(b.c().d);
a::(c().d.e);
a::(b());
a::(b::c());
a::(b()::c);
a::(b().c::d);
a::(b.c::d);
a::(b::c.d);
a::(b.c::d::e);
a::(b::c::d);
a::(b::c::d.e);
a::((b::c::d).e);
a::(void 0);
a::(b.c()::d.e);
a::(b.c::d.e);
a::(b.c::d.e)::f.g;
b.c::d.e;
(b.c::d).e;
(b::c::d).e;
new (a::b)();
new f(a::b);
f[a::b];
f[a::b()];
a::(import("foo"));
a::(import("foo").bar);
a::(import("foo")\`bar\`);
=====================================output=====================================
;(a || b)::c
a || b::c
;::obj.prop
;(void 0)::func()
;(+0)::is(-0)
a::b.c
a::(b.c())
a::b.c()
a::(b.c()())
a::(b.c()())
a::(b.c())()
a::(b.c().d)
a::(c().d.e)
a::(b())
a::(b::c())
a::(b()::c)
a::(b().c::d)
a::(b.c::d)
a::(b::c.d)
a::(b.c::d::e)
a::(b::c::d)
a::(b::c::d.e)
a::(b::c::d).e
a::(void 0)
a::(b.c()::d.e)
a::(b.c::d.e)
a::(b.c::d.e)::f.g
b.c::d.e
;(b.c::d).e
;(b::c::d).e
new (a::b)()
new f(a::b)
f[a::b]
f[a::b()]
a::(import("foo"))
a::(import("foo").bar)
a::(import("foo")\`bar\`)
================================================================================
`;
exports[`bind_parens.js - {"semi":false} format[acorn] 1`] = `
"Unexpected token (1:9)
> 1 | (a || b)::c;
| ^
2 | a || (b::c);
3 | ::obj.prop;
4 | (void 0)::func();
Cause: Unexpected token (1:8)"
`;
exports[`bind_parens.js - {"semi":false} format[espree] 1`] = `
"Unexpected token : (1:9)
> 1 | (a || b)::c;
| ^
2 | a || (b::c);
3 | ::obj.prop;
4 | (void 0)::func();
Cause: Unexpected token :"
`;
exports[`bind_parens.js - {"semi":false} format[meriyah] 1`] = `
"Unexpected token: ':' (1:9)
> 1 | (a || b)::c;
| ^
2 | a || (b::c);
3 | ::obj.prop;
4 | (void 0)::func();
Cause: [1:8-1:9]: Unexpected token: ':'"
`;
exports[`bind_parens.js - {"semi":false} format[oxc] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found none (1:9)
> 1 | (a || b)::c;
| ^
2 | a || (b::c);
3 | ::obj.prop;
4 | (void 0)::func();"
`;
exports[`bind_parens.js - {"semi":false} format[yuku] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found ':' (1:9)
> 1 | (a || b)::c;
| ^
2 | a || (b::c);
3 | ::obj.prop;
4 | (void 0)::func();"
`;
exports[`bind_parens.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -416,94 +207,6 @@ exports[`bind_parens.js format[yuku] 1`] = `
4 | (void 0)::func();"
`;
exports[`long_name_method.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
class X {
constructor() {
this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
}
testLongNameMethodAndSomethingElseLallala() {
return true;
}
}
=====================================output=====================================
class X {
constructor() {
this.testLongNameMethodAndSomethingElseLallala =
::this.testLongNameMethodAndSomethingElseLallala
}
testLongNameMethodAndSomethingElseLallala() {
return true
}
}
================================================================================
`;
exports[`long_name_method.js - {"semi":false} format[acorn] 1`] = `
"Unexpected token (3:54)
1 | class X {
2 | constructor() {
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
| ^
4 | }
5 |
6 | testLongNameMethodAndSomethingElseLallala() {
Cause: Unexpected token (3:53)"
`;
exports[`long_name_method.js - {"semi":false} format[espree] 1`] = `
"Unexpected token : (3:54)
1 | class X {
2 | constructor() {
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
| ^
4 | }
5 |
6 | testLongNameMethodAndSomethingElseLallala() {
Cause: Unexpected token :"
`;
exports[`long_name_method.js - {"semi":false} format[meriyah] 1`] = `
"Unexpected token: ':' (3:54)
1 | class X {
2 | constructor() {
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
| ^
4 | }
5 |
6 | testLongNameMethodAndSomethingElseLallala() {
Cause: [3:53-3:54]: Unexpected token: ':'"
`;
exports[`long_name_method.js - {"semi":false} format[oxc] 1`] = `
"Unexpected token (3:54)
1 | class X {
2 | constructor() {
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
| ^
4 | }
5 |
6 | testLongNameMethodAndSomethingElseLallala() {"
`;
exports[`long_name_method.js - {"semi":false} format[yuku] 1`] = `
"Unexpected token ':' (3:54)
1 | class X {
2 | constructor() {
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
| ^
4 | }
5 |
6 | testLongNameMethodAndSomethingElseLallala() {"
`;
exports[`long_name_method.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -591,110 +294,6 @@ exports[`long_name_method.js format[yuku] 1`] = `
6 | testLongNameMethodAndSomethingElseLallala() {"
`;
exports[`method_chain.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
import {interval} from 'rxjs/observable/interval';
import {filter} from 'rxjs/operator/filter';
import {take} from 'rxjs/operator/take';
import {map} from 'rxjs/operator/map';
import {throttle} from 'rxjs/operator/throttle';
import {takeUntil} from 'rxjs/operator/takeUntil';
function test(observable) {
return observable
::filter(data => data.someTest)
::throttle(() =>
interval(10)
::take(1)
::takeUntil(observable::filter(data => someOtherTest))
)
::map(someFunction);
}
=====================================output=====================================
import { interval } from "rxjs/observable/interval"
import { filter } from "rxjs/operator/filter"
import { take } from "rxjs/operator/take"
import { map } from "rxjs/operator/map"
import { throttle } from "rxjs/operator/throttle"
import { takeUntil } from "rxjs/operator/takeUntil"
function test(observable) {
return observable
::filter((data) => data.someTest)
::throttle(() =>
interval(10)
::take(1)
::takeUntil(observable::filter((data) => someOtherTest)),
)
::map(someFunction)
}
================================================================================
`;
exports[`method_chain.js - {"semi":false} format[acorn] 1`] = `
"Unexpected token (10:9)
8 | function test(observable) {
9 | return observable
> 10 | ::filter(data => data.someTest)
| ^
11 | ::throttle(() =>
12 | interval(10)
13 | ::take(1)
Cause: Unexpected token (10:8)"
`;
exports[`method_chain.js - {"semi":false} format[espree] 1`] = `
"Unexpected token : (10:9)
8 | function test(observable) {
9 | return observable
> 10 | ::filter(data => data.someTest)
| ^
11 | ::throttle(() =>
12 | interval(10)
13 | ::take(1)
Cause: Unexpected token :"
`;
exports[`method_chain.js - {"semi":false} format[meriyah] 1`] = `
"Unexpected token: ':' (10:9)
8 | function test(observable) {
9 | return observable
> 10 | ::filter(data => data.someTest)
| ^
11 | ::throttle(() =>
12 | interval(10)
13 | ::take(1)
Cause: [10:8-10:9]: Unexpected token: ':'"
`;
exports[`method_chain.js - {"semi":false} format[oxc] 1`] = `
"Unexpected token (10:9)
8 | function test(observable) {
9 | return observable
> 10 | ::filter(data => data.someTest)
| ^
11 | ::throttle(() =>
12 | interval(10)
13 | ::take(1)"
`;
exports[`method_chain.js - {"semi":false} format[yuku] 1`] = `
"Unexpected token ':' (10:9)
8 | function test(observable) {
9 | return observable
> 10 | ::filter(data => data.someTest)
| ^
11 | ::throttle(() =>
12 | interval(10)
13 | ::take(1)"
`;
exports[`method_chain.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -798,93 +397,6 @@ exports[`method_chain.js format[yuku] 1`] = `
13 | ::take(1)"
`;
exports[`short_name_method.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
class X {
constructor() {
this.shortMethod = ::this.shortMethod;
}
shortMethod() {
return true;
}
}
=====================================output=====================================
class X {
constructor() {
this.shortMethod = ::this.shortMethod
}
shortMethod() {
return true
}
}
================================================================================
`;
exports[`short_name_method.js - {"semi":false} format[acorn] 1`] = `
"Unexpected token (3:24)
1 | class X {
2 | constructor() {
> 3 | this.shortMethod = ::this.shortMethod;
| ^
4 | }
5 |
6 | shortMethod() {
Cause: Unexpected token (3:23)"
`;
exports[`short_name_method.js - {"semi":false} format[espree] 1`] = `
"Unexpected token : (3:24)
1 | class X {
2 | constructor() {
> 3 | this.shortMethod = ::this.shortMethod;
| ^
4 | }
5 |
6 | shortMethod() {
Cause: Unexpected token :"
`;
exports[`short_name_method.js - {"semi":false} format[meriyah] 1`] = `
"Unexpected token: ':' (3:24)
1 | class X {
2 | constructor() {
> 3 | this.shortMethod = ::this.shortMethod;
| ^
4 | }
5 |
6 | shortMethod() {
Cause: [3:23-3:24]: Unexpected token: ':'"
`;
exports[`short_name_method.js - {"semi":false} format[oxc] 1`] = `
"Unexpected token (3:24)
1 | class X {
2 | constructor() {
> 3 | this.shortMethod = ::this.shortMethod;
| ^
4 | }
5 |
6 | shortMethod() {"
`;
exports[`short_name_method.js - {"semi":false} format[yuku] 1`] = `
"Unexpected token ':' (3:24)
1 | class X {
2 | constructor() {
> 3 | this.shortMethod = ::this.shortMethod;
| ^
4 | }
5 |
6 | shortMethod() {"
`;
exports[`short_name_method.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -971,94 +483,6 @@ exports[`short_name_method.js format[yuku] 1`] = `
6 | shortMethod() {"
`;
exports[`unary.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
!x::y;
!(x::y /* foo */);
!(/* foo */ x::y);
!(
/* foo */
x::y
);
!(
x::y
/* foo */
);
!(
x::y // foo
);
=====================================output=====================================
!x::y
!(x::y /* foo */)
!(/* foo */ x::y)
!(
/* foo */
x::y
)
!(
x::y
/* foo */
)
!(
x::y // foo
)
================================================================================
`;
exports[`unary.js - {"semi":false} format[acorn] 1`] = `
"Unexpected token (1:3)
> 1 | !x::y;
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
4 | !(
Cause: Unexpected token (1:2)"
`;
exports[`unary.js - {"semi":false} format[espree] 1`] = `
"Unexpected token : (1:3)
> 1 | !x::y;
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
4 | !(
Cause: Unexpected token :"
`;
exports[`unary.js - {"semi":false} format[meriyah] 1`] = `
"Unexpected token: ':' (1:3)
> 1 | !x::y;
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
4 | !(
Cause: [1:2-1:3]: Unexpected token: ':'"
`;
exports[`unary.js - {"semi":false} format[oxc] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found none (1:3)
> 1 | !x::y;
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
4 | !("
`;
exports[`unary.js - {"semi":false} format[yuku] 1`] = `
"Expected a semicolon or an implicit semicolon after a statement, but found ':' (1:3)
> 1 | !x::y;
| ^
2 | !(x::y /* foo */);
3 | !(/* foo */ x::y);
4 | !("
`;
exports[`unary.js format 1`] = `
====================================options=====================================
parsers: ["babel"]
@@ -9,4 +9,3 @@ const errors = {
};
runFormatTest(import.meta, ["babel"], { errors });
runFormatTest(import.meta, ["babel"], { semi: false, errors });
@@ -9,28 +9,10 @@ semi: false
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof(){}
}
=====================================output=====================================
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof() {}
}
================================================================================
`;
@@ -40,8 +22,6 @@ exports[`no-semi.js - {"semi":false} format[acorn] 1`] = `
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;
Cause: Unexpected token (2:1)"
`;
@@ -51,8 +31,6 @@ exports[`no-semi.js - {"semi":false} format[espree] 1`] = `
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;
Cause: Unexpected token :"
`;
@@ -62,8 +40,6 @@ exports[`no-semi.js - {"semi":false} format[meriyah] 1`] = `
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;
Cause: [2:1-2:2]: Unexpected token: ':'"
`;
@@ -72,9 +48,7 @@ exports[`no-semi.js - {"semi":false} format[oxc] 1`] = `
1 | a
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;"
3 |"
`;
exports[`no-semi.js - {"semi":false} format[yuku] 1`] = `
@@ -82,9 +56,7 @@ exports[`no-semi.js - {"semi":false} format[yuku] 1`] = `
1 | a
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;"
3 |"
`;
exports[`no-semi.js format 1`] = `
@@ -95,28 +67,10 @@ parsers: ["babel"]
a
;::b.c
class A {
a = b;
in
c
a = b;
instanceof(){}
}
=====================================output=====================================
a;
::b.c;
class A {
a = b;
in;
c;
a = b;
instanceof() {}
}
================================================================================
`;
@@ -126,8 +80,6 @@ exports[`no-semi.js format[acorn] 1`] = `
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;
Cause: Unexpected token (2:1)"
`;
@@ -137,8 +89,6 @@ exports[`no-semi.js format[espree] 1`] = `
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;
Cause: Unexpected token :"
`;
@@ -148,8 +98,6 @@ exports[`no-semi.js format[meriyah] 1`] = `
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;
Cause: [2:1-2:2]: Unexpected token: ':'"
`;
@@ -158,9 +106,7 @@ exports[`no-semi.js format[oxc] 1`] = `
1 | a
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;"
3 |"
`;
exports[`no-semi.js format[yuku] 1`] = `
@@ -168,7 +114,5 @@ exports[`no-semi.js format[yuku] 1`] = `
1 | a
> 2 | ;::b.c
| ^
3 |
4 | class A {
5 | a = b;"
3 |"
`;
@@ -0,0 +1,2 @@
a
;::b.c
@@ -590,6 +590,61 @@ class G4 {
================================================================================
`;
exports[`class-2.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript", "flow"]
semi: false
printWidth: 80 (default) |
=====================================input======================================
class A {
a = b;
in
c
a = b;
instanceof(){}
}
=====================================output=====================================
class A {
a = b;
in
c
a = b;
instanceof() {}
}
================================================================================
`;
exports[`class-2.js format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript", "flow"]
printWidth: 80 (default) |
=====================================input======================================
class A {
a = b;
in
c
a = b;
instanceof(){}
}
=====================================output=====================================
class A {
a = b;
in;
c;
a = b;
instanceof() {}
}
================================================================================
`;
exports[`comments.js - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel", "typescript", "flow"]
@@ -1,6 +1,3 @@
a
;::b.c
class A {
a = b;
in