blob: 20a0484f259369df5574cbc2fea785d4c9c4d4b0 (
plain)
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
|
module Expression = ImportExpression.T
module Path = ImportDataTypes.Path
module Expr = Expression_builder
module M = Expr.Make (ImportExpression.Repr.E)
open Test_migration
let eval = M.eval ~path_repr:ImportCSV.Csv.column_to_string
let test_expr expr = ImportExpression.Repr.E.observe ~top:true expr
let assert_equal expected actual =
Alcotest.(check string) expected expected actual
let print_literal =
"print_litteral" >:: fun _ ->
let result = test_expr @@ eval (Literal "Content") in
assert_equal "'Content'" result
let print_quoted_literal =
"print_quoted_literal" >:: fun _ ->
let result = test_expr @@ eval Expression_builder.literal_quoted in
assert_equal "'\\''" result
let print_dquoted_literal =
"print_dquoted_literal" >:: fun _ ->
let result = test_expr @@ eval (Literal "\"") in
assert_equal "'\"'" result
let print_numeric =
"print_numeric" >:: fun _ ->
let result = test_expr @@ eval (Literal "123") in
assert_equal "123" result
let test_suit =
[ print_literal; print_quoted_literal; print_dquoted_literal; print_numeric ]
let tests = "expression_repr" >::: test_suit
|