123456789101112131415161718192021222324252627282930313233343536 |
- 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 indexed_text () = _test_instruction {|variable['<<$variable>>']|} report
- 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;
- Alcotest.test_case "Indexed text" `Quick indexed_text;
- ] )
|