@samitouri / QOS-React-2 / commits / d6dea6b9b9

[sprout][fixtures] Annotate some fixtures

--- This PR is an example of how to update fixture to add sprout annotations. Running with `yarn sprout --verbose --filter` shows the fixture outputs. ``` PASS array-access-assignment ok [[2],[[2],[],[3]]] PASS array-expression-spread ok [0,1,2,3,null,4,5,6,"z"] PASS array-map-frozen-array ok [[],[]] PASS array-map-mutable-array-mutating-lambda ok [[],[]] PASS array-pattern-params ok [{"a":"val1"},{"b":"val2"}] PASS array-properties ok {"a":[[1,2],2,"hello"],"x":3,"y":"[[ function params=1 ]]","z":"[[ function params=1 ]]"} PASS array-property-call ok {"a":[1,2,"hello",42],"x":4,"y":1} PASS assignment-expression-computed ok [7] PASS assignment-expression-nested-path ok {"b":{"c":6}} PASS capturing-func-mutate-2 ok {"a":2} PASS capturing-function-alias-computed-load-2 ok "val2" PASS capturing-function-alias-computed-load-4 ok "val2" ```

Mofei Zhang committed Aug 16, 2023 at 15:38 UTC d6dea6b9b90c790e69dfce7e7f0ceeb9d1bfe5d0
25 files changed +72 -84
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md
+4 -4
@@ -13,8 +13,8 @@ function foo(a, b, c) {
13
14 export const FIXTURE_ENTRYPOINT = {
15 fn: foo,
16 - params: ["TodoAdd"],
17 - isComponent: "TodoAdd",
16 + params: [1, 2, 3],
17 + isComponent: false,
18 };
19
20 ```
@@ -70,8 +70,8 @@ function foo(a, b, c) {
70
71 export const FIXTURE_ENTRYPOINT = {
72 fn: foo,
73 - params: ["TodoAdd"],
74 - isComponent: "TodoAdd",
73 + params: [1, 2, 3],
74 + isComponent: false,
75 };
76
77 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-access-assignment.js
+2 -2
@@ -9,6 +9,6 @@ function foo(a, b, c) {
9
10 export const FIXTURE_ENTRYPOINT = {
11 fn: foo,
12 - params: ["TodoAdd"],
13 - isComponent: "TodoAdd",
12 + params: [1, 2, 3],
13 + isComponent: false,
14 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md
+4 -4
@@ -9,8 +9,8 @@ function Component(props) {
9
10 export const FIXTURE_ENTRYPOINT = {
11 fn: Component,
12 - params: ["TodoAdd"],
13 - isComponent: "TodoAdd",
12 + params: [{ foo: [1, 2, 3], bar: [4, 5, 6] }],
13 + isComponent: false,
14 };
15
16 ```
@@ -38,8 +38,8 @@ function Component(props) {
38
39 export const FIXTURE_ENTRYPOINT = {
40 fn: Component,
41 - params: ["TodoAdd"],
42 - isComponent: "TodoAdd",
41 + params: [{ foo: [1, 2, 3], bar: [4, 5, 6] }],
42 + isComponent: false,
43 };
44
45 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-expression-spread.js
+2 -2
@@ -5,6 +5,6 @@ function Component(props) {
5
6 export const FIXTURE_ENTRYPOINT = {
7 fn: Component,
8 - params: ["TodoAdd"],
9 - isComponent: "TodoAdd",
8 + params: [{ foo: [1, 2, 3], bar: [4, 5, 6] }],
9 + isComponent: false,
10 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-frozen-array.expect.md
+4 -4
@@ -11,8 +11,8 @@ function Component(props) {
11
12 export const FIXTURE_ENTRYPOINT = {
13 fn: Component,
14 - params: ["TodoAdd"],
15 - isComponent: "TodoAdd",
14 + params: [{}],
15 + isComponent: false,
16 };
17
18 ```
@@ -58,8 +58,8 @@ function Component(props) {
58
59 export const FIXTURE_ENTRYPOINT = {
60 fn: Component,
61 - params: ["TodoAdd"],
62 - isComponent: "TodoAdd",
61 + params: [{}],
62 + isComponent: false,
63 };
64
65 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-frozen-array.js
+2 -2
@@ -7,6 +7,6 @@ function Component(props) {
7
8 export const FIXTURE_ENTRYPOINT = {
9 fn: Component,
10 - params: ["TodoAdd"],
11 - isComponent: "TodoAdd",
10 + params: [{}],
11 + isComponent: false,
12 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-mutable-array-mutating-lambda.expect.md
+4 -4
@@ -13,8 +13,8 @@ function Component(props) {
13
14 export const FIXTURE_ENTRYPOINT = {
15 fn: Component,
16 - params: ["TodoAdd"],
17 - isComponent: "TodoAdd",
16 + params: [{}],
17 + isComponent: false,
18 };
19
20 ```
@@ -59,8 +59,8 @@ function Component(props) {
59
60 export const FIXTURE_ENTRYPOINT = {
61 fn: Component,
62 - params: ["TodoAdd"],
63 - isComponent: "TodoAdd",
62 + params: [{}],
63 + isComponent: false,
64 };
65
66 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-map-mutable-array-mutating-lambda.js
+2 -2
@@ -9,6 +9,6 @@ function Component(props) {
9
10 export const FIXTURE_ENTRYPOINT = {
11 fn: Component,
12 - params: ["TodoAdd"],
13 - isComponent: "TodoAdd",
12 + params: [{}],
13 + isComponent: false,
14 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md
+4 -4
@@ -10,8 +10,8 @@ function component([a, b]) {
10
11 export const FIXTURE_ENTRYPOINT = {
12 fn: component,
13 - params: ["TodoAdd"],
14 - isComponent: "TodoAdd",
13 + params: [["val1", "val2"]],
14 + isComponent: false,
15 };
16
17 ```
@@ -59,8 +59,8 @@ function component(t16) {
59
60 export const FIXTURE_ENTRYPOINT = {
61 fn: component,
62 - params: ["TodoAdd"],
63 - isComponent: "TodoAdd",
62 + params: [["val1", "val2"]],
63 + isComponent: false,
64 };
65
66 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-pattern-params.js
+2 -2
@@ -6,6 +6,6 @@ function component([a, b]) {
6
7 export const FIXTURE_ENTRYPOINT = {
8 fn: component,
9 - params: ["TodoAdd"],
10 - isComponent: "TodoAdd",
9 + params: [["val1", "val2"]],
10 + isComponent: false,
11 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.expect.md
+4 -4
@@ -11,8 +11,8 @@ function Component(props) {
11
12 export const FIXTURE_ENTRYPOINT = {
13 fn: Component,
14 - params: ["TodoAdd"],
15 - isComponent: "TodoAdd",
14 + params: [{ a: [1, 2], b: 2 }],
15 + isComponent: false,
16 };
17
18 ```
@@ -55,8 +55,8 @@ function Component(props) {
55
56 export const FIXTURE_ENTRYPOINT = {
57 fn: Component,
58 - params: ["TodoAdd"],
59 - isComponent: "TodoAdd",
58 + params: [{ a: [1, 2], b: 2 }],
59 + isComponent: false,
60 };
61
62 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-properties.js
+2 -2
@@ -7,6 +7,6 @@ function Component(props) {
7
8 export const FIXTURE_ENTRYPOINT = {
9 fn: Component,
10 - params: ["TodoAdd"],
11 - isComponent: "TodoAdd",
10 + params: [{ a: [1, 2], b: 2 }],
11 + isComponent: false,
12 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.expect.md
+4 -4
@@ -12,8 +12,8 @@ function Component(props) {
12
13 export const FIXTURE_ENTRYPOINT = {
14 fn: Component,
15 - params: ["TodoAdd"],
16 - isComponent: "TodoAdd",
15 + params: [{ a: 1, b: 2, c: 0 }],
16 + isComponent: false,
17 };
18
19 ```
@@ -70,8 +70,8 @@ function Component(props) {
70
71 export const FIXTURE_ENTRYPOINT = {
72 fn: Component,
73 - params: ["TodoAdd"],
74 - isComponent: "TodoAdd",
73 + params: [{ a: 1, b: 2, c: 0 }],
74 + isComponent: false,
75 };
76
77 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/array-property-call.js
+2 -2
@@ -8,6 +8,6 @@ function Component(props) {
8
9 export const FIXTURE_ENTRYPOINT = {
10 fn: Component,
11 - params: ["TodoAdd"],
12 - isComponent: "TodoAdd",
11 + params: [{ a: 1, b: 2, c: 0 }],
12 + isComponent: false,
13 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md
+4 -4
@@ -12,8 +12,8 @@ function Component(props) {
12
13 export const FIXTURE_ENTRYPOINT = {
14 fn: Component,
15 - params: ["TodoAdd"],
16 - isComponent: "TodoAdd",
15 + params: [{ x: 2 }],
16 + isComponent: false,
17 };
18
19 ```
@@ -41,8 +41,8 @@ function Component(props) {
41
42 export const FIXTURE_ENTRYPOINT = {
43 fn: Component,
44 - params: ["TodoAdd"],
45 - isComponent: "TodoAdd",
44 + params: [{ x: 2 }],
45 + isComponent: false,
46 };
47
48 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-computed.js
+2 -2
@@ -8,6 +8,6 @@ function Component(props) {
8
9 export const FIXTURE_ENTRYPOINT = {
10 fn: Component,
11 - params: ["TodoAdd"],
12 - isComponent: "TodoAdd",
11 + params: [{ x: 2 }],
12 + isComponent: false,
13 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md
+4 -4
@@ -11,8 +11,8 @@ function g(props) {
11
12 export const FIXTURE_ENTRYPOINT = {
13 fn: g,
14 - params: ["TodoAdd"],
15 - isComponent: "TodoAdd",
14 + params: [{ c: 2 }],
15 + isComponent: false,
16 };
17
18 ```
@@ -39,8 +39,8 @@ function g(props) {
39
40 export const FIXTURE_ENTRYPOINT = {
41 fn: g,
42 - params: ["TodoAdd"],
43 - isComponent: "TodoAdd",
42 + params: [{ c: 2 }],
43 + isComponent: false,
44 };
45
46 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.js
+2 -2
@@ -7,6 +7,6 @@ function g(props) {
7
8 export const FIXTURE_ENTRYPOINT = {
9 fn: g,
10 - params: ["TodoAdd"],
11 - isComponent: "TodoAdd",
10 + params: [{ c: 2 }],
11 + isComponent: false,
12 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md
+4 -4
@@ -15,8 +15,8 @@ function component(a, b) {
15
16 export const FIXTURE_ENTRYPOINT = {
17 fn: component,
18 - params: ["TodoAdd"],
19 - isComponent: "TodoAdd",
18 + params: [{ a: "val1", b: "val2" }],
19 + isComponent: false,
20 };
21
22 ```
@@ -58,8 +58,8 @@ function component(a, b) {
58
59 export const FIXTURE_ENTRYPOINT = {
60 fn: component,
61 - params: ["TodoAdd"],
62 - isComponent: "TodoAdd",
61 + params: [{ a: "val1", b: "val2" }],
62 + isComponent: false,
63 };
64
65 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.js
+2 -2
@@ -11,6 +11,6 @@ function component(a, b) {
11
12 export const FIXTURE_ENTRYPOINT = {
13 fn: component,
14 - params: ["TodoAdd"],
15 - isComponent: "TodoAdd",
14 + params: [{ a: "val1", b: "val2" }],
15 + isComponent: false,
16 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md
+4 -4
@@ -14,8 +14,8 @@ function bar(a) {
14
15 export const FIXTURE_ENTRYPOINT = {
16 fn: bar,
17 - params: ["TodoAdd"],
18 - isComponent: "TodoAdd",
17 + params: [["val1", "val2"]],
18 + isComponent: false,
19 };
20
21 ```
@@ -44,8 +44,8 @@ function bar(a) {
44
45 export const FIXTURE_ENTRYPOINT = {
46 fn: bar,
47 - params: ["TodoAdd"],
48 - isComponent: "TodoAdd",
47 + params: [["val1", "val2"]],
48 + isComponent: false,
49 };
50
51 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.js
+2 -2
@@ -10,6 +10,6 @@ function bar(a) {
10
11 export const FIXTURE_ENTRYPOINT = {
12 fn: bar,
13 - params: ["TodoAdd"],
14 - isComponent: "TodoAdd",
13 + params: [["val1", "val2"]],
14 + isComponent: false,
15 };
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md
+4 -4
@@ -14,8 +14,8 @@ function bar(a) {
14
15 export const FIXTURE_ENTRYPOINT = {
16 fn: bar,
17 - params: ["TodoAdd"],
18 - isComponent: "TodoAdd",
17 + params: [{ a: ["val1", "val2"] }],
18 + isComponent: false,
19 };
20
21 ```
@@ -44,8 +44,8 @@ function bar(a) {
44
45 export const FIXTURE_ENTRYPOINT = {
46 fn: bar,
47 - params: ["TodoAdd"],
48 - isComponent: "TodoAdd",
47 + params: [{ a: ["val1", "val2"] }],
48 + isComponent: false,
49 };
50
51 ```
compiler/forget/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.js
+2 -2
@@ -10,6 +10,6 @@ function bar(a) {
10
11 export const FIXTURE_ENTRYPOINT = {
12 fn: bar,
13 - params: ["TodoAdd"],
14 - isComponent: "TodoAdd",
13 + params: [{ a: ["val1", "val2"] }],
14 + isComponent: false,
15 };
compiler/forget/packages/sprout/src/SproutTodoFilter.ts
-12
@@ -16,28 +16,16 @@ const skipFilter = new Set([
16 * Category B:
17 * Tests with at least one param and 0 refs to external values
18 */
19 - "array-access-assignment",
20 - "array-expression-spread",
21 - "array-map-frozen-array",
22 - "array-map-mutable-array-mutating-lambda",
23 - "array-pattern-params",
24 - "array-properties",
25 - "array-property-call",
26 - "assignment-expression-computed",
27 - "assignment-expression-nested-path",
19 "bug_object-pattern",
20 "bug.useMemo-deps-array-not-cleared",
21 "capture_mutate-across-fns",
22 "capture-indirect-mutate-alias",
23 "capturing-arrow-function-1",
33 - "capturing-func-mutate-2",
24 "capturing-func-mutate-3",
25 "capturing-func-mutate-nested",
26 "capturing-func-mutate",
27 "capturing-function-1",
38 - "capturing-function-alias-computed-load-2",
28 "capturing-function-alias-computed-load-3",
40 - "capturing-function-alias-computed-load-4",
29 "capturing-function-alias-computed-load",
30 "capturing-function-decl",
31 "capturing-function-skip-computed-path",