aboutsummaryrefslogtreecommitdiff
path: root/test/nested_string.ml
blob: 3338fa37b14c2520fc0ba6765efd3a4d3af26286 (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
module Check = Make_checkTest.M (Qsp_syntax.Nested_strings)

let _position = (Lexing.dummy_pos, Lexing.dummy_pos)

let _test_instruction : string -> Qsp_syntax.Report.t list -> unit =
  Check._test_instruction

let report =
  [
    {
      Qsp_syntax.Report.level = Debug;
      Qsp_syntax.Report.loc = _position;
      Qsp_syntax.Report.message = "This expression can be simplified";
    };
  ]

let nothing () = _test_instruction {|"value = <<$variable>>"|} []
let string () = _test_instruction {|"<<'ABC'>>"|} report
let string_variable () = _test_instruction {|"<<$variable>>"|} report

(** It’s OK to use this system to convert a numeric value into a string *)
let integer () = _test_instruction {|"<<123>>"|} []

let integer_variable () = _test_instruction {|"<<variable>>"|} []

let test =
  ( "Nested_strings checker",
    [
      Alcotest.test_case "Ok" `Quick nothing;
      Alcotest.test_case "String variable" `Quick string_variable;
      Alcotest.test_case "Integer" `Quick integer;
      Alcotest.test_case "String" `Quick string;
      Alcotest.test_case "Integer variable" `Quick integer_variable;
    ] )