Skip to content

Commit 1a0d7c7

Browse files
committed
update tests with single line comments
1 parent 6530e39 commit 1a0d7c7

File tree

17 files changed

+1987
-463
lines changed

17 files changed

+1987
-463
lines changed

formatTest/typeCheckedTests/expected_output/attributes.re

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,44 @@ type itemText = int [@@itemAttributeOnTypeDef];
1515

1616
type nodeText = int;
1717

18-
type nodeAndItemText = int [@@itemAttributeOnTypeDef];
18+
type nodeAndItemText = int
19+
[@@itemAttributeOnTypeDef];
1920

2021
type itemDoc = int [@@itemAttributeOnTypeDef];
2122

2223
type nodeDoc = int [@@itemAttributeOnTypeDef];
2324

24-
type nodeAndItemDoc = int [@@itemAttributeOnTypeDef];
25+
type nodeAndItemDoc = int
26+
[@@itemAttributeOnTypeDef];
2527

2628
type x = int [@@itemAttributeOnTypeDef];
2729

2830
type attributedInt = int [@onTopLevelTypeDef];
2931

30-
type attributedIntsInTuple = (int [@onInt], float [@onFloat]) [@@onTopLevelTypeDef];
32+
type attributedIntsInTuple = (
33+
int [@onInt],
34+
float [@onFloat]
35+
)
36+
[@@onTopLevelTypeDef];
3137

3238
type myDataType 'x 'y = | MyDataType of 'x 'y;
3339

3440
type myType =
35-
(myDataType ((option int) [@onOptionInt]) ((option float) [@onOption])) [@onEntireType];
41+
(
42+
myDataType
43+
((option int) [@onOptionInt])
44+
((option float) [@onOption])
45+
)
46+
[@onEntireType];
3647

37-
let thisInst: myType = MyDataType (Some 10) (Some 10.0) [@attOnEntireDatatype];
48+
let thisInst: myType =
49+
MyDataType (Some 10) (Some 10.0)
50+
[@attOnEntireDatatype];
3851

3952
let thisInst: myType =
40-
MyDataType (Some 10 [@onFirstParam]) (Some 10.0) [@attOnEntireDatatype];
53+
MyDataType
54+
(Some 10 [@onFirstParam]) (Some 10.0)
55+
[@attOnEntireDatatype];
4156

4257
let x = "hello" [@onHello];
4358

@@ -112,7 +127,8 @@ let res =
112127

113128
let add a b => ((a [@onA]) + b) [@onEverything];
114129

115-
let add a b => ((a [@onA]) + (b [@onB])) [@onEverything];
130+
let add a b =>
131+
((a [@onA]) + (b [@onB])) [@onEverything];
116132

117133
let add a b => a + (b [@onB]);
118134

@@ -126,25 +142,34 @@ let both a b => (a && b) [@onEverything];
126142

127143
let thisVal = 10;
128144

129-
let x = 20 + (- (add thisVal thisVal [@onFunctionCall]));
145+
let x = 20 + (
146+
- (add thisVal thisVal [@onFunctionCall])
147+
);
130148

131-
let x = (20 + (- (add thisVal thisVal))) [@onEverything];
149+
let x =
150+
(20 + (- (add thisVal thisVal)))
151+
[@onEverything];
132152

133153
let x = - (add thisVal thisVal [@onFunctionCall]);
134154

135155
let x = (- (add thisVal thisVal)) [@onEverything];
136156

137157
let bothTrue x y => {contents: x && y};
138158

139-
let something = !(bothTrue true true) [@onEverythingToRightOfEquals];
159+
let something =
160+
!(bothTrue true true)
161+
[@onEverythingToRightOfEquals];
140162

141-
let res = add 2 4 [@appliesToEntireFunctionApplication];
163+
let res =
164+
add 2 4 [@appliesToEntireFunctionApplication];
142165

143166
add 2 4 [@appliesToEntireFunctionApplication];
144167

145168
let myObj = {method p () => {method z () => 10}};
146169

147-
let result = (myObj#p () [@attOnFirstSend])#z () [@onSecondSend];
170+
let result =
171+
(myObj#p () [@attOnFirstSend])#z
172+
() [@onSecondSend];
148173

149174
type recordFunctions = {
150175
p: unit => recordFunctions [@onUnit],
@@ -153,17 +178,29 @@ type recordFunctions = {
153178
[@@onRecordFunctions]
154179
and unusedType = unit [@@onUnusedType];
155180

156-
let rec myRecord = {p: fun () => myRecord, q: fun () => ()}
181+
let rec myRecord = {
182+
p: fun () => myRecord,
183+
q: fun () => ()
184+
}
157185
and unused = ();
158186

159-
let result = (myRecord.p () [@attOnFirstSend]).q () [@onSecondSend];
187+
let result =
188+
(myRecord.p () [@attOnFirstSend]).q
189+
() [@onSecondSend];
160190

161-
type variantType = | Foo of int [@onInt] | Bar of (int [@onInt]) | Baz [@@onVariantType];
191+
type variantType =
192+
| Foo of int [@onInt]
193+
| Bar of (int [@onInt])
194+
| Baz
195+
[@@onVariantType];
162196

163197
type gadtType 'x =
164198
| Foo of int :(gadtType int) [@onFirstRow]
165-
| Bar of (int [@onInt]) :(gadtType unit) [@onSecondRow]
166-
| Baz :(gadtType (unit [@onUnit])) [@onThirdRow]
199+
| Bar of
200+
(int [@onInt])
201+
:(gadtType unit) [@onSecondRow]
202+
| Baz
203+
:(gadtType (unit [@onUnit])) [@onThirdRow]
167204
[@@onVariantType];
168205

169206
[@@@floatingTopLevelStructureItem hello];
@@ -235,7 +272,10 @@ class tupleClass 'a 'b (init: ('a, 'b)) => {
235272
class type addablePointClassType = {
236273
method x: int;
237274
method y: int;
238-
method add: addablePointClassType => addablePointClassType => int
275+
method add:
276+
addablePointClassType =>
277+
addablePointClassType =>
278+
int
239279
}
240280
[@@structureItem]
241281
and anotherClassType = {
@@ -244,7 +284,9 @@ and anotherClassType = {
244284
}
245285
[@@structureItem];
246286

247-
let module NestedModule = {[@@@floatingNestedStructureItem hello];};
287+
let module NestedModule = {
288+
[@@@floatingNestedStructureItem hello];
289+
};
248290

249291
module type HasAttrs = {
250292
type t = int [@@onTypeDef];
@@ -261,13 +303,19 @@ type s = | S of string;
261303

262304
let S (str [@onStr]) = S ("hello" [@onHello]);
263305

264-
let S str [@onConstruction] = S "hello" [@onConstruction];
306+
let S str [@onConstruction] =
307+
S "hello" [@onConstruction];
265308

266309
type xy = | X of string | Y of string;
267310

268-
let myFun (X hello [@onConstruction] | Y hello [@onConstruction]) => hello;
311+
let myFun
312+
(
313+
X hello [@onConstruction] |
314+
Y hello [@onConstruction]
315+
) => hello;
269316

270-
let myFun (X (hello [@onHello]) | Y (hello [@onHello])) => hello;
317+
let myFun
318+
(X (hello [@onHello]) | Y (hello [@onHello])) => hello;
271319

272320
/* Another bug: Cannot have an attribute on or pattern
273321
let myFun = fun ((X hello | Y hello) [@onOrPattern]) => hello;

formatTest/typeCheckedTests/expected_output/basics.re

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
2-
type reasonXyz = | X | Y of int int int | Z of int int | Q | R;
2+
type reasonXyz =
3+
| X | Y of int int int | Z of int int | Q | R;
34

45
let reasonBarAs =
56
fun | ((Y _ | Z _) as t, _) => {
@@ -42,6 +43,8 @@ let (\+) = (+);
4243

4344
let (\===) = (===);
4445

45-
let expectedPrecendence = 1 + 1 \=== 1 + 1 && 1 + 1 !== 1 + 1;
46+
let expectedPrecendence =
47+
1 + 1 \=== 1 + 1 && 1 + 1 !== 1 + 1;
4648

47-
let expectedPrecendence = 1 \+ 1 \=== 1 \+ 1 && 1 \+ 1 !== 1 \+ 1;
49+
let expectedPrecendence =
50+
1 \+ 1 \=== 1 \+ 1 && 1 \+ 1 !== 1 \+ 1;

formatTest/typeCheckedTests/expected_output/mlSyntax.re

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/*
33
* Testing pattern matching using ml syntax to exercise nesting of cases.
44
*/
5-
type xyz = | X | Y of int int int | Z of int int | Q | R;
5+
type xyz =
6+
| X | Y of int int int | Z of int int | Q | R;
67

78
let doubleBar =
89
fun | X
@@ -76,6 +77,9 @@ let nestedSome = Some (1, 2, Some (1, 2, 3));
7677

7778
let nestedSomeSimple = Some (Some (1, 2, 3));
7879

79-
let module EM = {/* Exception */exception E of int int;};
80+
let module EM = {
81+
/* Exception */
82+
exception E of int int;
83+
};
8084

8185
exception Ealias = EM.E;

formatTest/typeCheckedTests/expected_output/mlVariants.re

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
2-
type polyVariantsInMl = [ | `IntTuple of (int, int) | `StillAnIntTuple of (int, int)];
2+
type polyVariantsInMl = [
3+
| `IntTuple of (int, int)
4+
| `StillAnIntTuple of (int, int)
5+
];
36

47
let intTuple = `IntTuple (1, 2);
58

formatTest/typeCheckedTests/expected_output/mutation.re

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ switch numberToSwitchOn {
3737
| (-1) => ()
3838
| 0 => holdsAUnit.contents = ()
3939
| 1 => holdsAUnit.contents = holdsAnInt := 0
40-
| 2 => true ? holdsAUnit.contents = () : holdsABool.contents ? () : ()
41-
| 3 => true ? holdsAUnit := () : holdsABool.contents ? () : ()
40+
| 2 =>
41+
true ?
42+
holdsAUnit.contents = () :
43+
holdsABool.contents ? () : ()
44+
| 3 =>
45+
true ?
46+
holdsAUnit := () :
47+
holdsABool.contents ? () : ()
4248
| 4 => true ? holdsAnInt := 40 : ()
4349
| 5 => holdsAnInt := 40
4450
| _ => ()

0 commit comments

Comments
 (0)