From 2b747378a0be51a180150d62a9c703e00dda8e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Ch=C3=A1varri?= Date: Thu, 28 Mar 2024 10:10:18 +0000 Subject: [PATCH] better tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Javier Chávarri --- .../test-cases/merlin/get-set-contexts.t | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/test/blackbox-tests/test-cases/merlin/get-set-contexts.t b/test/blackbox-tests/test-cases/merlin/get-set-contexts.t index 8bfccd1297f2..1b63096144a6 100644 --- a/test/blackbox-tests/test-cases/merlin/get-set-contexts.t +++ b/test/blackbox-tests/test-cases/merlin/get-set-contexts.t @@ -19,6 +19,58 @@ Showcase behavior of the GetContexts ocaml-merlin command Showcase behavior of the SetContext ocaml-merlin command - $ FILE=$PWD/lib3.ml - $ printf '(4:File%d:%s)(10:SetContext3:alt)(4:File%d:%s)(4:File%d:%s)' ${#FILE} $FILE | dune ocaml-merlin - ((5:ERROR59:No config found for file lib3.ml. Try calling 'dune build'.))((5:ERROR53:No config found for file .. Try calling 'dune build'.))((5:ERROR53:No config found for file .. Try calling 'dune build'.)) + $ lib1=foo + $ lib2=bar + $ cat >dune < (library + > (name $lib1) + > (modules $lib1) + > (enabled_if (= %{context_name} "default"))) + > (library + > (name $lib2) + > (modules $lib2) + > (enabled_if (= %{context_name} "alt"))) + > EOF + + $ touch $lib1.ml $lib2.ml + + $ dune build + + $ FILE1=$PWD/$lib1.ml + $ FILE2=$PWD/$lib2.ml + +Request config for file in alt context before calling SetContext + + $ printf '(4:File%d:%s)' ${#FILE2} $FILE2 | dune ocaml-merlin | dune format-dune-file + ((5:ERROR58:No config found for file bar.ml. Try calling 'dune build'.)) + +Request config for file in alt context after calling SetContext + + $ printf '(10:SetContext3:alt)(4:File%d:%s)' ${#FILE2} $FILE2 | dune ocaml-merlin | dune format-dune-file + ((5:ERROR58:No config found for file bar.ml. Try calling 'dune build'.)) + +Request config for file in default context before and after calling SetContext + + $ printf '(4:File%d:%s)(10:SetContext3:alt)(4:File%d:%s)' ${#FILE1} $FILE1 ${#FILE1} $FILE1 | dune ocaml-merlin | dune format-dune-file + ((6:STDLIB34:/home/me/code/dune/_opam/lib/ocaml) + (17:EXCLUDE_QUERY_DIR) + (1:B143:$TESTCASE_ROOT/_build/default/.foo.objs/byte) + (1:S113:$TESTCASE_ROOT) + (3:FLG + (2:-w51:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-4016:-strict-sequence15:-strict-formats12:-short-paths10:-keep-locs2:-g))) + + ((5:ERROR58:No config found for file foo.ml. Try calling 'dune build'.)) + +Combine all + + $ printf '(4:File%d:%s)(10:SetContext3:alt)(4:File%d:%s)(4:File%d:%s)' ${#FILE1} $FILE1 ${#FILE1} $FILE1 ${#FILE2} $FILE2 | dune ocaml-merlin | dune format-dune-file + ((6:STDLIB34:/home/me/code/dune/_opam/lib/ocaml) + (17:EXCLUDE_QUERY_DIR) + (1:B143:$TESTCASE_ROOT/_build/default/.foo.objs/byte) + (1:S113:$TESTCASE_ROOT) + (3:FLG + (2:-w51:@1..3@5..28@31..39@43@46..47@49..57@61..62@67@69-4016:-strict-sequence15:-strict-formats12:-short-paths10:-keep-locs2:-g))) + + ((5:ERROR58:No config found for file foo.ml. Try calling 'dune build'.)) + + ((5:ERROR58:No config found for file bar.ml. Try calling 'dune build'.))