66This package adds useful additions to the functionality provided by ` Test ` , the Julia
77standard library for writing tests.
88
9- # What's new in version 0.2
9+ # What's new in version 0.3.3
1010
11- * The way in which ` @constinferred ` defines a new function has been changed so as to avoid
12- "method overwrite" warnings in Julia v1.10 and higher.
13- * Since Julia v1.8, the default ` Test.@testset ` prints elapsed timings of tests, thereby
14- replicating the behaviour of ` @timedtestset ` and making the latter superfluous. However,
15- ` @timedtestset ` and its associated test set type ` TimedTestSet ` remains available in
16- TestExtras.jl in order to support older Julia versions. It is now a literal copy of the
17- ` DefaultTestSet ` implementation as in the ` Test ` standard library of Julia 1.8 and thus
18- also supports the ` verbose ` keyword.
11+ * Introduction of a ` @testinferred ` macro, that unlike ` @constinferred ` can be used inside
12+ functions, but does not apply constant propagation. However, unlike ` Test.@inferred ` , it
13+ does contribute to the test results.
1914
2015# Short description of the package
2116
22- The first feature of TestExtras.jl is a macro ` @constinferred ` , which is a replacement of
23- ` Test.@inferred ` but with two major differences.
17+ The first feature of TestExtras.jl are the macros ` @testinferred ` and ` @constinferred ` ,
18+ which are a replacement of ` Test.@inferred ` but with two major differences.
2419
25201 . Unlike ` Test.@inferred ` , the comparison between the actual and inferred runtype is a
2621 proper test which contributes to the total number of passed or failed tests.
@@ -39,6 +34,12 @@ The first feature of TestExtras.jl is a macro `@constinferred`, which is a repl
3934 in the test, for example because you want to loop over possible values. In that case,
4035 you can interpolate the value into the ` @constinferred ` expression.
4136
37+ However, because this macro works by defining a new function, it cannot be used inside
38+ other functions. Therefore, ` @testinferred ` is provided as a variant that works inside
39+ functions, but without constant propagation. In fact, ` @constinferred f(args...) ` is
40+ equivalent to ` @testinferred f(args...) constprop=true ` , where the optional keyword argument
41+ ` constprop ` (default ` false ` ) controls whether constant propagation is applied.
42+
4243Some example is probably more insightful. We define a new function ` mysqrt ` that is
4344type-unstable with respect to real values of the argument ` x ` , at least if the keyword
4445argument ` complex = true ` .
0 commit comments