forked from shakacode/re-formality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.re
60 lines (57 loc) · 2.51 KB
/
Test.re
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
let check = (Case.{expected, actual}) =>
Alcotest.(check(Case.testable, "same string", expected, actual));
let ok = case => {
Alcotest.test_case(case, `Quick, () => case |> Case.ok |> check);
};
let error = case => {
Alcotest.test_case(case, `Quick, () => case |> Case.error |> check);
};
let () =
Alcotest.(
run(
"Ppx",
[
(
"oks",
[
"Ok__FieldWithNoValidator",
"Ok__FieldWithSyncValidator",
"Ok__FieldWithAsyncValidatorInOnChangeMode",
"Ok__FieldWithAsyncValidatorInOnBlurMode",
"Ok__FieldWithSyncValidatorAndFieldWithAsyncValidatorInOnChangeMode",
"Ok__FieldWithSyncValidatorAndFieldWithAsyncValidatorInOnBlurMode",
"Ok__FieldWithSyncValidatorAndDependentFieldAndFieldWithSyncValidator",
"Ok__FieldWithSyncValidatorAndTwoDependentFieldsWithSyncValidators",
"Ok__TwoFieldsWithNoValidators",
"Ok__TwoFieldsWithSyncValidators",
"Ok__TwoFieldsWithAsyncValidatorsInOnChangeMode",
"Ok__TwoFieldsWithAsyncValidatorsInOnBlurMode",
"Ok__TwoFieldsWithSyncValidatorAndFieldWithAsyncValidatorInOnChangeMode",
"Ok__TwoFieldsWithSyncValidatorAndFieldWithAsyncValidatorInOnBlurMode",
"Ok__FieldWithSyncValidatorAndFieldWithNoValidator",
"Ok__FieldWithSyncValidatorAndCollectionWithNoCollectionValidatorAndFieldWithSyncValidator",
"Ok__CollectionWithNoCollectionValidatorAndFieldOfCollectionWithSyncValidator",
"Ok__CollectionWithCollectionValidatorAndFieldOfCollectionWithSyncValidator",
"Ok__CollectionWithNoCollectionValidatorAndFieldOfCollectionWithAsyncValidatorInOnChangeMode",
"Ok__CollectionWithNoCollectionValidatorAndFieldOfCollectionWithAsyncValidatorInOnBlurMode",
"Ok__CollectionWithCollectionValidatorAndFieldOfCollectionWithAsyncValidatorInOnChangeMode",
"Ok__CollectionWithCollectionValidatorAndFieldOfCollectionWithAsyncValidatorInOnBlurMode",
"Ok__CollectionWithNoCollectionValidatorAndTwoFieldsOfCollectionWithSyncValidator",
"Ok__Message",
"Ok__SubmissionError",
"Ok__Metadata",
"Ok__Include",
"Ok__LargeFormWithValidators",
]
|> List.rev
|> List.rev_map(ok),
),
(
"errors",
["Error__InputNotFound", "Error__InputNotRecord"]
|> List.rev
|> List.rev_map(error),
),
],
)
);