aboutsummaryrefslogtreecommitdiff
path: root/test/location.ml
blob: cf2008f6f399e0c4dbff636b6bf3996f7624169f (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
37
38
module Check = Make_checkTest.M (Qsp_checks.Locations)

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

let error_message =
  [
    ( "Location",
      Check.
        {
          level = Error;
          loc = _position;
          message = "The location unknown_place does not exists";
        } );
  ]

let ok () = Check.global_check "gt 'location'" []
let ok_upper () = Check.global_check "gt 'LOCATION'" []
let missing_gt () = Check.global_check "gt 'unknown_place'" error_message
let missing_gs () = Check.global_check "gs 'unknown_place'" error_message

let act_missing_gs () =
  Check.global_check {|
act "test": gs 'unknown_place'|} error_message

let if_missing_gs () =
  Check.global_check {|
  if 0: gs 'unknown_place'|} error_message

let test =
  ( "Locations",
    [
      Alcotest.test_case "Ok" `Quick ok;
      Alcotest.test_case "Ok upper" `Quick ok_upper;
      Alcotest.test_case "Missing GT" `Quick missing_gt;
      Alcotest.test_case "Missing GS" `Quick missing_gs;
      Alcotest.test_case "Missing GS in block" `Quick act_missing_gs;
      Alcotest.test_case "Missing GS in block'" `Quick if_missing_gs;
    ] )