Skip to content

Commit

Permalink
test: Showcase warning detection false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
Julow committed Oct 31, 2023
1 parent 3226c6e commit c69241f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/bin/mdx-test/expect/warnings/test-case.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,36 @@ Warning 9 [missing-record-field-pattern]: the following labels are not bound in
y
Either bind these labels explicitly or add '; _' to the pattern.
```

Test against some false positives:

```ocaml
let x = [ "Warning" ]
```
```mdx-error
val x : string list = ["Warning"]
```

```ocaml
module Warning = struct
type t = Warning
end
let warning = Warning.Warning
```
```mdx-error
module Warning : sig type t = Warning end
val warning : Warning.t = Warning.Warning
```

Intended false positive:

```ocaml
let x =
if true then
prerr_endline "Warning: Assert failed";
[ "foo" ]
```
```mdx-error
Warning: Assert failed
```

0 comments on commit c69241f

Please sign in to comment.