Skip to content

Commit 81f3dfd

Browse files
mununkicknitt
authored andcommitted
add test
1 parent 13d148a commit 81f3dfd

15 files changed

+30
-110
lines changed

res_syntax/tests/ppx/react/expected/aliasProps.res.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
@@jsxConfig({version: 4, mode: "automatic"})
22

33
module C0 = {
4-
type props<'priority, 'text> = {
5-
priority: 'priority,
6-
text?: 'text,
7-
}
4+
type props<'priority, 'text> = {priority: 'priority, text?: 'text}
85

96
@react.component
107
let make = ({priority: _, ?text, _}: props<'priority, 'text>) => {
@@ -23,10 +20,7 @@ module C0 = {
2320
}
2421

2522
module C1 = {
26-
type props<'priority, 'text> = {
27-
priority: 'priority,
28-
text?: 'text,
29-
}
23+
type props<'priority, 'text> = {priority: 'priority, text?: 'text}
3024

3125
@react.component
3226
let make = ({priority: p, ?text, _}: props<'priority, 'text>) => {

res_syntax/tests/ppx/react/expected/commentAtTop.res.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
type props<'msg> = { // test React JSX file
2-
msg: 'msg,
3-
}
1+
type props<'msg> = {msg: 'msg} // test React JSX file
42

53
@react.component
64
let make = ({msg, _}: props<'msg>) => {

res_syntax/tests/ppx/react/expected/externalWithCustomName.res.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ let t = React.createElement(Foo.component, Foo.componentProps(~a=1, ~b={"1"}, ()
1313
@@jsxConfig({version: 4, mode: "classic"})
1414

1515
module Foo = {
16-
type props<'a, 'b> = {
17-
a: 'a,
18-
b: 'b,
19-
}
16+
type props<'a, 'b> = {a: 'a, b: 'b}
2017

2118
@module("Foo")
2219
external component: React.componentLike<props<int, string>, React.element> = "component"
@@ -27,10 +24,7 @@ let t = React.createElement(Foo.component, {a: 1, b: "1"})
2724
@@jsxConfig({version: 4, mode: "automatic"})
2825

2926
module Foo = {
30-
type props<'a, 'b> = {
31-
a: 'a,
32-
b: 'b,
33-
}
27+
type props<'a, 'b> = {a: 'a, b: 'b}
3428

3529
@module("Foo")
3630
external component: React.componentLike<props<int, string>, React.element> = "component"

res_syntax/tests/ppx/react/expected/fileLevelConfig.res.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ module V3 = {
1818
@@jsxConfig({version: 4, mode: "classic"})
1919

2020
module V4C = {
21-
type props<'msg> = {
22-
msg: 'msg,
23-
}
21+
type props<'msg> = {msg: 'msg}
2422

2523
@react.component
2624
let make = ({msg, _}: props<'msg>) => {
@@ -36,9 +34,7 @@ module V4C = {
3634
@@jsxConfig({version: 4, mode: "automatic"})
3735

3836
module V4A = {
39-
type props<'msg> = {
40-
msg: 'msg,
41-
}
37+
type props<'msg> = {msg: 'msg}
4238

4339
@react.component
4440
let make = ({msg, _}: props<'msg>) => {

res_syntax/tests/ppx/react/expected/interface.res.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module A = {
2-
type props<'x> = {
3-
x: 'x,
4-
}
2+
type props<'x> = {x: 'x}
53
@react.component let make = ({x, _}: props<'x>) => React.string(x)
64
let make = {
75
let \"Interface$A" = (props: props<_>) => make(props)

res_syntax/tests/ppx/react/expected/interface.resi.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module A: {
2-
type props<'x> = {
3-
x: 'x,
4-
}
2+
type props<'x> = {x: 'x}
53
let make: React.componentLike<props<string>, React.element>
64
}
75

res_syntax/tests/ppx/react/expected/interfaceWithRef.res.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
type props<'x, 'ref> = {
2-
x: 'x,
3-
ref?: 'ref,
4-
}
1+
type props<'x, 'ref> = {x: 'x, ref?: 'ref}
52
@react.component
63
let make = (
74
{x, _}: props<string, ReactDOM.Ref.currentDomRef>,
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
type props<'x, 'ref> = {
2-
x: 'x,
3-
ref?: 'ref,
4-
}
1+
type props<'x, 'ref> = {x: 'x, ref?: 'ref}
52
let make: React.componentLike<props<string, ReactDOM.Ref.currentDomRef>, React.element>

res_syntax/tests/ppx/react/expected/mangleKeyword.res.txt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ let c31 = React.createElement(C31.make, C31.makeProps(~_open="x", ()))
2020
@@jsxConfig({version: 4, mode: "classic"})
2121

2222
module C4C0 = {
23-
type props<'T_open, 'T_type> = {
24-
@as("open") _open: 'T_open,
25-
@as("type") _type: 'T_type,
26-
}
23+
type props<'T_open, 'T_type> = {@as("open") _open: 'T_open, @as("type") _type: 'T_type}
2724

2825
@react.component
2926
let make = ({@as("open") _open, @as("type") _type, _}: props<'T_open, string>) =>
@@ -35,10 +32,7 @@ module C4C0 = {
3532
}
3633
}
3734
module C4C1 = {
38-
type props<'T_open, 'T_type> = {
39-
@as("open") _open: 'T_open,
40-
@as("type") _type: 'T_type,
41-
}
35+
type props<'T_open, 'T_type> = {@as("open") _open: 'T_open, @as("type") _type: 'T_type}
4236

4337
external make: @as("open") React.componentLike<props<string, string>, React.element> = "default"
4438
}
@@ -49,10 +43,7 @@ let c4c1 = React.createElement(C4C1.make, {_open: "x", _type: "t"})
4943
@@jsxConfig({version: 4, mode: "automatic"})
5044

5145
module C4A0 = {
52-
type props<'T_open, 'T_type> = {
53-
@as("open") _open: 'T_open,
54-
@as("type") _type: 'T_type,
55-
}
46+
type props<'T_open, 'T_type> = {@as("open") _open: 'T_open, @as("type") _type: 'T_type}
5647

5748
@react.component
5849
let make = ({@as("open") _open, @as("type") _type, _}: props<'T_open, string>) =>
@@ -64,10 +55,7 @@ module C4A0 = {
6455
}
6556
}
6657
module C4A1 = {
67-
type props<'T_open, 'T_type> = {
68-
@as("open") _open: 'T_open,
69-
@as("type") _type: 'T_type,
70-
}
58+
type props<'T_open, 'T_type> = {@as("open") _open: 'T_open, @as("type") _type: 'T_type}
7159

7260
external make: @as("open") React.componentLike<props<string, string>, React.element> = "default"
7361
}

res_syntax/tests/ppx/react/expected/newtype.res.txt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ module V3 = {
2424
@@jsxConfig({version: 4, mode: "classic"})
2525

2626
module V4C = {
27-
type props<'a, 'b, 'c> = {
28-
a: 'a,
29-
b: 'b,
30-
c: 'c,
31-
}
27+
type props<'a, 'b, 'c> = {a: 'a, b: 'b, c: 'c}
3228

3329
@react.component
3430
let make = ({a, b, c, _}: props<'\"type-a", array<option<[#Foo('\"type-a")]>>, 'a>) =>
@@ -43,11 +39,7 @@ module V4C = {
4339
@@jsxConfig({version: 4, mode: "automatic"})
4440

4541
module V4A = {
46-
type props<'a, 'b, 'c> = {
47-
a: 'a,
48-
b: 'b,
49-
c: 'c,
50-
}
42+
type props<'a, 'b, 'c> = {a: 'a, b: 'b, c: 'c}
5143

5244
@react.component
5345
let make = ({a, b, c, _}: props<'\"type-a", array<option<[#Foo('\"type-a")]>>, 'a>) =>

res_syntax/tests/ppx/react/expected/optimizeAutomaticMode.res.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ module User = {
44
type t = {firstName: string, lastName: string}
55

66
let format = user => "Dr." ++ user.lastName
7-
type props<'doctor> = {
8-
doctor: 'doctor,
9-
}
7+
type props<'doctor> = {doctor: 'doctor}
108

119
@react.component
1210
let make = ({doctor, _}: props<'doctor>) => {

res_syntax/tests/ppx/react/expected/removedKeyProp.res.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
@@jsxConfig({version: 4, mode: "classic"})
22

33
module Foo = {
4-
type props<'x, 'y> = {
5-
x: 'x,
6-
y: 'y,
7-
}
4+
type props<'x, 'y> = {x: 'x, y: 'y}
85

96
@react.component let make = ({x, y, _}: props<'x, 'y>) => React.string(x ++ y)
107
let make = {
@@ -15,9 +12,7 @@ module Foo = {
1512
}
1613

1714
module HasChildren = {
18-
type props<'children> = {
19-
children: 'children,
20-
}
15+
type props<'children> = {children: 'children}
2116

2217
@react.component
2318
let make = ({children, _}: props<'children>) => ReactDOM.createElement(React.fragment, [children])

res_syntax/tests/ppx/react/expected/topLevel.res.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ module V3 = {
2222
@@jsxConfig({version: 4, mode: "classic"})
2323

2424
module V4C = {
25-
type props<'a, 'b> = {
26-
a: 'a,
27-
b: 'b,
28-
}
25+
type props<'a, 'b> = {a: 'a, b: 'b}
2926

3027
@react.component
3128
let make = ({a, b, _}: props<'a, 'b>) => {
@@ -42,10 +39,7 @@ module V4C = {
4239
@@jsxConfig({version: 4, mode: "automatic"})
4340

4441
module V4A = {
45-
type props<'a, 'b> = {
46-
a: 'a,
47-
b: 'b,
48-
}
42+
type props<'a, 'b> = {a: 'a, b: 'b}
4943

5044
@react.component
5145
let make = ({a, b, _}: props<'a, 'b>) => {

res_syntax/tests/ppx/react/expected/typeConstraint.res.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ module V3 = {
1717
@@jsxConfig({version: 4, mode: "classic"})
1818

1919
module V4C = {
20-
type props<'a, 'b> = {
21-
a: 'a,
22-
b: 'b,
23-
}
20+
type props<'a, 'b> = {a: 'a, b: 'b}
2421

2522
@react.component
2623
let make = ({a, b, _}: props<'\"type-a", '\"type-a">) =>
@@ -35,10 +32,7 @@ module V4C = {
3532
@@jsxConfig({version: 4, mode: "automatic"})
3633

3734
module V4A = {
38-
type props<'a, 'b> = {
39-
a: 'a,
40-
b: 'b,
41-
}
35+
type props<'a, 'b> = {a: 'a, b: 'b}
4236

4337
@react.component let make = ({a, b, _}: props<'\"type-a", '\"type-a">) => ReactDOM.jsx("div", {})
4438
let make = {
Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
type props<'x, 'y> = { // Component with type constraint
2-
x: 'x,
3-
y: 'y,
4-
}
1+
type props<'x, 'y> = {x: 'x, y: 'y} // Component with type constraint
52
@react.component let make = ({x, y, _}: props<string, string>) => React.string(x ++ y)
63
let make = {
74
let \"V4" = (props: props<_>) => make(props)
@@ -10,9 +7,7 @@ let make = {
107

118
module AnotherName = {
129
type // Component with another name than "make"
13-
props<'x> = {
14-
x: 'x,
15-
}
10+
props<'x> = {x: 'x}
1611

1712
@react.component let anotherName = ({x, _}: props<'x>) => React.string(x)
1813
let anotherName = {
@@ -23,9 +18,7 @@ module AnotherName = {
2318
}
2419

2520
module Uncurried = {
26-
type props<'x> = {
27-
x: 'x,
28-
}
21+
type props<'x> = {x: 'x}
2922

3023
@react.component let make = ({x, _}: props<'x>) => React.string(x)
3124
let make = {
@@ -36,25 +29,19 @@ module Uncurried = {
3629
}
3730

3831
module type TUncurried = {
39-
type props<'x> = {
40-
x: 'x,
41-
}
32+
type props<'x> = {x: 'x}
4233

4334
let make: React.componentLike<props<string>, React.element>
4435
}
4536

4637
module E = {
47-
type props<'x> = {
48-
x: 'x,
49-
}
38+
type props<'x> = {x: 'x}
5039

5140
external make: React.componentLike<props<string>, React.element> = "default"
5241
}
5342

5443
module EUncurried = {
55-
type props<'x> = {
56-
x: 'x,
57-
}
44+
type props<'x> = {x: 'x}
5845

5946
external make: React.componentLike<props<string>, React.element> = "default"
6047
}

0 commit comments

Comments
 (0)