Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit e39c867

Browse files
committed
add tests
1 parent 3ff277d commit e39c867

File tree

4 files changed

+158
-4
lines changed

4 files changed

+158
-4
lines changed

tests/ppx/react/expected/sharedProps.res.txt

+72-2
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,52 @@ module V4C2 = {
2323
}
2424

2525
module V4C3 = {
26+
type props<'a> = sharedProps<string, 'a>
27+
28+
@react.component(: sharedProps<string, 'a>)
29+
let make = ({x, y, _}: props<'a>) => React.string(x ++ y)
30+
let make = {
31+
let \"SharedProps$V4C3" = (props: props<_>) => make(props)
32+
33+
\"SharedProps$V4C3"
34+
}
35+
}
36+
37+
module V4C4 = {
38+
type props = sharedProps
39+
40+
@react.component(: sharedProps) let make = ({x, y, _}: props) => React.string(x ++ y)
41+
let make = {
42+
let \"SharedProps$V4C4" = props => make(props)
43+
44+
\"SharedProps$V4C4"
45+
}
46+
}
47+
48+
module V4C5 = {
2649
type props = sharedProps<string>
2750

2851
external make: React.componentLike<props, React.element> = "default"
2952
}
3053

31-
module V4C4 = {
54+
module V4C6 = {
3255
type props<'a> = sharedProps<'a>
3356

3457
external make: React.componentLike<props<'a>, React.element> = "default"
3558
}
3659

60+
module V4C7 = {
61+
type props<'a> = sharedProps<string, 'a>
62+
63+
external make: React.componentLike<props<'a>, React.element> = "default"
64+
}
65+
66+
module V4C8 = {
67+
type props = sharedProps
68+
69+
external make: React.componentLike<props, React.element> = "default"
70+
}
71+
3772
@@jsxConfig({version: 4, mode: "automatic"})
3873

3974
module V4A1 = {
@@ -59,13 +94,48 @@ module V4A2 = {
5994
}
6095

6196
module V4A3 = {
97+
type props<'a> = sharedProps<string, 'a>
98+
99+
@react.component(: sharedProps<string, 'a>)
100+
let make = ({x, y, _}: props<'a>) => React.string(x ++ y)
101+
let make = {
102+
let \"SharedProps$V4A3" = (props: props<_>) => make(props)
103+
104+
\"SharedProps$V4A3"
105+
}
106+
}
107+
108+
module V4A4 = {
109+
type props = sharedProps
110+
111+
@react.component(: sharedProps) let make = ({x, y, _}: props) => React.string(x ++ y)
112+
let make = {
113+
let \"SharedProps$V4A4" = props => make(props)
114+
115+
\"SharedProps$V4A4"
116+
}
117+
}
118+
119+
module V4A5 = {
62120
type props = sharedProps<string>
63121

64122
external make: React.componentLike<props, React.element> = "default"
65123
}
66124

67-
module V4A4 = {
125+
module V4A6 = {
68126
type props<'a> = sharedProps<'a>
69127

70128
external make: React.componentLike<props<'a>, React.element> = "default"
71129
}
130+
131+
module V4A7 = {
132+
type props<'a> = sharedProps<string, 'a>
133+
134+
external make: React.componentLike<props<'a>, React.element> = "default"
135+
}
136+
137+
module V4A8 = {
138+
type props = sharedProps
139+
140+
external make: React.componentLike<props, React.element> = "default"
141+
}

tests/ppx/react/expected/sharedProps.resi.txt

+24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ module V4C2: {
1212
let make: React.componentLike<props<'a>, React.element>
1313
}
1414

15+
module V4C3: {
16+
type props<'a> = sharedProps<string, 'a>
17+
18+
let make: React.componentLike<props<'a>, React.element>
19+
}
20+
21+
module V4C4: {
22+
type props = sharedProps
23+
24+
let make: React.componentLike<props, React.element>
25+
}
26+
1527
@@jsxConfig({version: 4, mode: "automatic"})
1628

1729
module V4A1: {
@@ -25,3 +37,15 @@ module V4A2: {
2537

2638
let make: React.componentLike<props<'a>, React.element>
2739
}
40+
41+
module V4A3: {
42+
type props<'a> = sharedProps<string, 'a>
43+
44+
let make: React.componentLike<props<'a>, React.element>
45+
}
46+
47+
module V4A4: {
48+
type props = sharedProps
49+
50+
let make: React.componentLike<props, React.element>
51+
}

tests/ppx/react/sharedProps.res

+42-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,35 @@ module V4C2 = {
1111
}
1212

1313
module V4C3 = {
14+
@react.component(:sharedProps<string, 'a>)
15+
let make = (~x, ~y) => React.string(x ++ y)
16+
}
17+
18+
module V4C4 = {
19+
@react.component(:sharedProps)
20+
let make = (~x, ~y) => React.string(x ++ y)
21+
}
22+
23+
module V4C5 = {
1424
@react.component(:sharedProps<string>)
1525
external make: (~x: string, ~y: 'a) => React.element = "default"
1626
}
1727

18-
module V4C4 = {
28+
module V4C6 = {
1929
@react.component(:sharedProps<'a>)
2030
external make: (~x: string, ~y: 'a) => React.element = "default"
2131
}
2232

33+
module V4C7 = {
34+
@react.component(:sharedProps<string, 'a>)
35+
external make: (~x: string, ~y: string) => React.element = "default"
36+
}
37+
38+
module V4C8 = {
39+
@react.component(:sharedProps)
40+
external make: (~x: string, ~y: string) => React.element = "default"
41+
}
42+
2343
@@jsxConfig({version:4, mode: "automatic"})
2444

2545
module V4A1 = {
@@ -33,11 +53,31 @@ module V4A2 = {
3353
}
3454

3555
module V4A3 = {
56+
@react.component(:sharedProps<string, 'a>)
57+
let make = (~x, ~y) => React.string(x ++ y)
58+
}
59+
60+
module V4A4 = {
61+
@react.component(:sharedProps)
62+
let make = (~x, ~y) => React.string(x ++ y)
63+
}
64+
65+
module V4A5 = {
3666
@react.component(:sharedProps<string>)
3767
external make: (~x: string, ~y: 'a) => React.element = "default"
3868
}
3969

40-
module V4A4 = {
70+
module V4A6 = {
4171
@react.component(:sharedProps<'a>)
4272
external make: (~x: string, ~y: 'a) => React.element = "default"
73+
}
74+
75+
module V4A7 = {
76+
@react.component(:sharedProps<string, 'a>)
77+
external make: (~x: string, ~y: string) => React.element = "default"
78+
}
79+
80+
module V4A8 = {
81+
@react.component(:sharedProps)
82+
external make: (~x: string, ~y: string) => React.element = "default"
4383
}

tests/ppx/react/sharedProps.resi

+20
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ module V4C2: {
1010
let make: (~x: string) => React.element
1111
}
1212

13+
module V4C3: {
14+
@react.component(:sharedProps<string, 'a>)
15+
let make: (~x: string) => React.element
16+
}
17+
18+
module V4C4 : {
19+
@react.component(:sharedProps)
20+
let make: (~x: string) => React.element
21+
}
22+
1323
@@jsxConfig({version:4, mode: "automatic"})
1424

1525
module V4A1: {
@@ -20,4 +30,14 @@ module V4A1: {
2030
module V4A2: {
2131
@react.component(:sharedProps<'a>)
2232
let make: (~x: string) => React.element
33+
}
34+
35+
module V4A3: {
36+
@react.component(:sharedProps<string, 'a>)
37+
let make: (~x: string) => React.element
38+
}
39+
40+
module V4A4: {
41+
@react.component(:sharedProps)
42+
let make: (~x: string) => React.element
2343
}

0 commit comments

Comments
 (0)