| 1 |
This test won't work with MSVC as it's using GCC and clang CLI |
| 2 |
parameters. |
| 3 |
|
| 4 |
The flag should be present in the command, as we want it in the |
| 5 |
:standard set. |
| 6 |
|
| 7 |
We don't actually test that the compiler outputs colors, just that |
| 8 |
Dune correctly passes the flag when required, and doesn't when it's |
| 9 |
not. |
| 10 |
|
| 11 |
test that we pass the flag |
| 12 |
========================== |
| 13 |
|
| 14 |
$ cat >dune <<EOF |
| 15 |
> (library |
| 16 |
> (name test) |
| 17 |
> (foreign_stubs (language c) (names stub))) |
| 18 |
> EOF |
| 19 |
|
| 20 |
$ dune rules stub.o | grep -ce "-fdiagnostics-color=always" |
| 21 |
1 |
| 22 |
|
| 23 |
test color flag disabled |
| 24 |
======================== |
| 25 |
|
| 26 |
$ cat >dune <<EOF |
| 27 |
> (library |
| 28 |
> (name test) |
| 29 |
> (foreign_stubs |
| 30 |
> (flags :standard \ -fdiagnostics-color=always) |
| 31 |
> (language c) (names stub))) |
| 32 |
> EOF |
| 33 |
|
| 34 |
$ dune rules stub.o | grep -ce "-fdiagnostics-color=always" |
| 35 |
0 |
| 36 |
[1] |
| 37 |
|
| 38 |
test that we correctly filter out the color codes |
| 39 |
================================================= |
| 40 |
|
| 41 |
$ cat >dune <<EOF |
| 42 |
> (library |
| 43 |
> (name test) |
| 44 |
> (foreign_stubs |
| 45 |
> (language c) (names stub))) |
| 46 |
> EOF |
| 47 |
|
| 48 |
We check there is no ESC [ sequence. |
| 49 |
|
| 50 |
$ dune build 2>&1 | grep `printf '\033\\['` |
| 51 |
[1] |