Skip to content

Commit 80ad971

Browse files
committed
Update more tests (ppx)
1 parent ad321b1 commit 80ad971

20 files changed

+159
-45
lines changed

tests/syntax_tests/data/ppx/react/expected/aliasProps.res.txt

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
module C0 = {
44
@res.jsxComponentProps
5-
type props<'priority, 'text> = {priority: 'priority, text?: 'text}
5+
type props<'priority, 'text> = {
6+
priority: 'priority,
7+
text?: 'text,
8+
}
69

710
let make = ({priority: _, text: ?__text, _}: props<_, _>) => {
811
let text = switch __text {
@@ -20,7 +23,10 @@ module C0 = {
2023

2124
module C1 = {
2225
@res.jsxComponentProps
23-
type props<'priority, 'text> = {priority: 'priority, text?: 'text}
26+
type props<'priority, 'text> = {
27+
priority: 'priority,
28+
text?: 'text,
29+
}
2430

2531
let make = ({priority: p, text: ?__text, _}: props<_, _>) => {
2632
let text = switch __text {
@@ -38,7 +44,9 @@ module C1 = {
3844

3945
module C2 = {
4046
@res.jsxComponentProps
41-
type props<'foo> = {foo?: 'foo}
47+
type props<'foo> = {
48+
foo?: 'foo,
49+
}
4250

4351
let make = ({foo: ?__bar, _}: props<_>) => {
4452
let bar = switch __bar {
@@ -56,7 +64,11 @@ module C2 = {
5664

5765
module C3 = {
5866
@res.jsxComponentProps
59-
type props<'foo, 'a, 'b> = {foo?: 'foo, a?: 'a, b: 'b}
67+
type props<'foo, 'a, 'b> = {
68+
foo?: 'foo,
69+
a?: 'a,
70+
b: 'b,
71+
}
6072

6173
let make = ({foo: ?__bar, a: ?__a, b, _}: props<_, _, _>) => {
6274
let bar = switch __bar {
@@ -82,7 +94,10 @@ module C3 = {
8294

8395
module C4 = {
8496
@res.jsxComponentProps
85-
type props<'a, 'x> = {a: 'a, x?: 'x}
97+
type props<'a, 'x> = {
98+
a: 'a,
99+
x?: 'x,
100+
}
86101

87102
let make = ({a: b, x: ?__x, _}: props<_, _>) => {
88103
let x = switch __x {
@@ -100,7 +115,10 @@ module C4 = {
100115

101116
module C5 = {
102117
@res.jsxComponentProps
103-
type props<'a, 'z> = {a: 'a, z?: 'z}
118+
type props<'a, 'z> = {
119+
a: 'a,
120+
z?: 'z,
121+
}
104122

105123
let make = ({a: (x, y), z: ?__z, _}: props<_, _>) => {
106124
let z = switch __z {
@@ -124,7 +142,10 @@ module C6 = {
124142
let make: React.component<props>
125143
}
126144
@res.jsxComponentProps
127-
type props<'comp, 'x> = {comp: 'comp, x: 'x}
145+
type props<'comp, 'x> = {
146+
comp: 'comp,
147+
x: 'x,
148+
}
128149

129150
let make = ({comp: module(Comp: Comp), x: (a, b), _}: props<_, _>): React.element =>
130151
React.jsx(Comp.make, {})

tests/syntax_tests/data/ppx/react/expected/asyncAwait.res.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ let f = a => Js.Promise.resolve(a + a)
22

33
module C0 = {
44
@res.jsxComponentProps
5-
type props<'a> = {a: 'a}
5+
type props<'a> = {
6+
a: 'a,
7+
}
68

79
let make = async ({a, _}: props<_>) => {
810
let a = await f(a)
@@ -17,7 +19,9 @@ module C0 = {
1719

1820
module C1 = {
1921
@res.jsxComponentProps
20-
type props<'status> = {status: 'status}
22+
type props<'status> = {
23+
status: 'status,
24+
}
2125

2226
let make = async ({status, _}: props<_>): React.element => {
2327
switch status {

tests/syntax_tests/data/ppx/react/expected/commentAtTop.res.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@res.jsxComponentProps
2-
type props<'msg> = {msg: 'msg} // test React JSX file
2+
type props<'msg> = {
3+
msg: 'msg, // test React JSX file
4+
}
35

46
let make = ({msg, _}: props<_>): React.element => {
57
ReactDOM.jsx("div", {children: ?ReactDOM.someElement({msg->React.string})})

tests/syntax_tests/data/ppx/react/expected/defaultValueProp.res.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
module C0 = {
22
@res.jsxComponentProps
3-
type props<'a, 'b> = {a?: 'a, b?: 'b}
3+
type props<'a, 'b> = {
4+
a?: 'a,
5+
b?: 'b,
6+
}
47
let make = ({a: ?__a, b: ?__b, _}: props<_, _>) => {
58
let a = switch __a {
69
| Some(a) => a
@@ -20,7 +23,10 @@ module C0 = {
2023

2124
module C1 = {
2225
@res.jsxComponentProps
23-
type props<'a, 'b> = {a?: 'a, b: 'b}
26+
type props<'a, 'b> = {
27+
a?: 'a,
28+
b: 'b,
29+
}
2430

2531
let make = ({a: ?__a, b, _}: props<_, _>) => {
2632
let a = switch __a {
@@ -39,7 +45,9 @@ module C1 = {
3945
module C2 = {
4046
let a = "foo"
4147
@res.jsxComponentProps
42-
type props<'a> = {a?: 'a}
48+
type props<'a> = {
49+
a?: 'a,
50+
}
4351

4452
let make = ({a: ?__a, _}: props<_>) => {
4553
let a = switch __a {
@@ -57,7 +65,9 @@ module C2 = {
5765

5866
module C3 = {
5967
@res.jsxComponentProps
60-
type props<'disabled> = {disabled?: 'disabled}
68+
type props<'disabled> = {
69+
disabled?: 'disabled,
70+
}
6171

6272
let make = ({disabled: ?__everythingDisabled, _}: props<bool>) => {
6373
let everythingDisabled = switch __everythingDisabled {

tests/syntax_tests/data/ppx/react/expected/externalWithCustomName.res.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
module Foo = {
44
@res.jsxComponentProps @live
5-
type props<'a, 'b> = {a: 'a, b: 'b}
5+
type props<'a, 'b> = {
6+
a: 'a,
7+
b: 'b,
8+
}
69

710
@module("Foo")
811
external component: React.component<props<int, string>> = "component"

tests/syntax_tests/data/ppx/react/expected/fileLevelConfig.res.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
module V4A = {
44
@res.jsxComponentProps
5-
type props<'msg> = {msg: 'msg}
5+
type props<'msg> = {
6+
msg: 'msg,
7+
}
68

79
let make = ({msg, _}: props<_>): React.element => {
810
ReactDOM.jsx("div", {children: ?ReactDOM.someElement({msg->React.string})})

tests/syntax_tests/data/ppx/react/expected/forwardRef.resi.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ module V4C: {
1414

1515
module ForwardRef: {
1616
@res.jsxComponentProps
17-
type props<'ref> = {ref?: 'ref}
17+
type props<'ref> = {
18+
ref?: 'ref,
19+
}
1820

1921
let make: React.component<props<React.ref<Js.Nullable.t<inputRef>>>>
2022
}
@@ -34,7 +36,9 @@ module V4CUncurried: {
3436

3537
module ForwardRef: {
3638
@res.jsxComponentProps
37-
type props<'ref> = {ref?: 'ref}
39+
type props<'ref> = {
40+
ref?: 'ref,
41+
}
3842

3943
let make: React.component<props<React.ref<Js.Nullable.t<inputRef>>>>
4044
}
@@ -56,7 +60,9 @@ module V4A: {
5660

5761
module ForwardRef: {
5862
@res.jsxComponentProps
59-
type props<'ref> = {ref?: 'ref}
63+
type props<'ref> = {
64+
ref?: 'ref,
65+
}
6066

6167
let make: React.component<props<React.ref<Js.Nullable.t<inputRef>>>>
6268
}
@@ -76,7 +82,9 @@ module V4AUncurried: {
7682

7783
module ForwardRef: {
7884
@res.jsxComponentProps
79-
type props<'ref> = {ref?: 'ref}
85+
type props<'ref> = {
86+
ref?: 'ref,
87+
}
8088

8189
let make: React.component<props<React.ref<Js.Nullable.t<inputRef>>>>
8290
}

tests/syntax_tests/data/ppx/react/expected/interface.res.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module A = {
22
@res.jsxComponentProps
3-
type props<'x> = {x: 'x}
3+
type props<'x> = {
4+
x: 'x,
5+
}
46
let make = ({x, _}: props<_>): React.element => React.string(x)
57
let make = {
68
let \"Interface$A" = (props: props<_>) => make(props)

tests/syntax_tests/data/ppx/react/expected/interface.resi.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module A: {
22
@res.jsxComponentProps
3-
type props<'x> = {x: 'x}
3+
type props<'x> = {
4+
x: 'x,
5+
}
46
let make: React.component<props<string>>
57
}
68

tests/syntax_tests/data/ppx/react/expected/interfaceWithRef.res.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
@res.jsxComponentProps type props<'x, 'ref> = {x: 'x, ref?: 'ref}
1+
@res.jsxComponentProps
2+
type props<'x, 'ref> = {
3+
x: 'x,
4+
ref?: 'ref,
5+
}
26
let make = (
37
{x, _}: props<string, ReactDOM.Ref.currentDomRef>,
48
ref: Js.Nullable.t<ReactDOM.Ref.currentDomRef>,

0 commit comments

Comments
 (0)