vincent-hugot / qtest

Inline (Unit) Tests for OCaml
GNU General Public License v3.0
67 stars 8 forks source link

Another case of \ causing issue #51

Closed rixed closed 6 years ago

rixed commented 6 years ago

When breaking string literals with \ then qtest does not count lines properly, and report errors as if the literals were occupying only one line. Exemple:

in testme.ml:

let x =
  "hello \
\
\
  I'm line 5 but I'm innocent!"

(*$T
  badaboum!
*)

Makefile:

all: all_tests.opt
        ./all_tests.opt

%.cmx: %.ml
        ocamlfind ocamlopt -o $@ -c $<

all_tests.ml: testme.ml
        qtest --shuffle -o $@ extract $^

all_tests.opt: testme.cmx all_tests.ml
        ocamlfind ocamlopt -o $@ -package qcheck -linkpkg $^

clean:
        $(RM) all_tests.* *.cmx *.cmi *.opt *.o *.cache *.log

On qtest master, one get:

File "testme.ml", line 5, characters 11-12:
Error: Syntax error: operator expected.

line 5 is wrong.

This is annoying especially whit large blocks of ($injected) code.

c-cube commented 6 years ago

I will look at it, thank you!