@@ -25,26 +25,23 @@ To throw an error if any warnings occur inside any functions, set
25
25
`nowarn=:all`.
26
26
27
27
To throw an error if any warnings occur inside any functions EXCEPT for a
28
- certain set of functions, set `nowarn=:allexcept` and list the exceptions in
29
- the `except` variable, i.e. set `except=[f, g, h, ... ]`
28
+ certain set of functions, list the exceptions in the `except` variable,
29
+ for example `except=[f,g,h ]`
30
30
"""
31
31
function check (f; nowarn= Any[], except= Any[], kwargs... )
32
- if nowarn isa Symbol
32
+ if ! isempty (except) # if `except` is provided, we ignore the value of `nowarn`
33
33
_nowarn = Any[]
34
- if nowarn == :all
35
- _nowarn_all = true
36
- _nowarn_allexcept = false
37
- elseif nowarn == :allexcept
38
- _nowarn_all = false
39
- _nowarn_allexcept = true
40
- else
41
- throw (ArgumentError (" :$(nowarn) is not a valid value for nowarn" ))
42
- end
34
+ _nowarn_all = false
35
+ _nowarn_allexcept = true
36
+ elseif nowarn isa Symbol
37
+ _nowarn = Any[]
38
+ _nowarn_all = nowarn == :all
39
+ _nowarn_allexcept = false
43
40
else
44
41
_nowarn = nowarn
45
42
_nowarn_all = false
46
43
_nowarn_allexcept = false
47
- end
44
+ end
48
45
failed = false
49
46
wp = warning_printer ()
50
47
result = trace (f; kwargs... ) do warning
@@ -73,8 +70,8 @@ To throw an error if any warnings occur inside any functions, set
73
70
`nowarn=:all`.
74
71
75
72
To throw an error if any warnings occur inside any functions EXCEPT for a
76
- certain set of functions, set `nowarn=:allexcept` and list the exceptions in
77
- the `except` variable, i.e. set `except=[f, g, h, ... ]`
73
+ certain set of functions, list the exceptions in the `except` variable,
74
+ for example `except=[f,g,h ]`
78
75
"""
79
76
macro check (expr, args... )
80
77
quote
0 commit comments