From 5acc63c0653b363d3d6dc9217e0a29d7e44cbcaa Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Mon, 6 Nov 2023 15:07:28 +0100 Subject: In the string expression simplification, only report the strings converted into strings --- test/nested_string.ml | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/nested_string.ml b/test/nested_string.ml index b121667..3338fa3 100644 --- a/test/nested_string.ml +++ b/test/nested_string.ml @@ -5,23 +5,30 @@ let _position = (Lexing.dummy_pos, Lexing.dummy_pos) let _test_instruction : string -> Qsp_syntax.Report.t list -> unit = Check._test_instruction -let nothing () = _test_instruction {| -"value = <<$variable>>" - |} [] +let report = + [ + { + Qsp_syntax.Report.level = Debug; + Qsp_syntax.Report.loc = _position; + Qsp_syntax.Report.message = "This expression can be simplified"; + }; + ] -let simple_expression () = - _test_instruction {|"<<$variable>>"|} - [ - { - level = Debug; - loc = _position; - 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 {|"<>"|} [] let test = ( "Nested_strings checker", [ Alcotest.test_case "Ok" `Quick nothing; - Alcotest.test_case "Simple expression" `Quick simple_expression; + 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; ] ) -- cgit v1.2.3