Skip to content

Commit

Permalink
Fix example docs when built with Julia <= 1.10
Browse files Browse the repository at this point in the history
Previously, due to a bug in Test, this showed no printing at all
  • Loading branch information
Seelengrab committed Feb 20, 2024
1 parent 076a4fe commit c476a53
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/src/Examples/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,20 @@ And check that they hold like so. Of course, we can also test the property impli
```@example example_add; output = false, filter = r"\d+\.\d+s"
using Test
@testset "Additive properties" begin
Supposition.@check associative(Data.Just(add), intgen, intgen, intgen)
Supposition.@check identity_add(Data.Just(add), intgen)
Supposition.@check successor(intgen, intgen)
Supposition.@check commutative(intgen, intgen)
end
Supposition.@check associative(Data.Just(add), intgen, intgen, intgen)
Supposition.@check identity_add(Data.Just(add), intgen)
Supposition.@check successor(intgen, intgen)
Supposition.@check commutative(intgen, intgen)
nothing # hide
```

In this way, we can even reuse properties from other invocations of `@check` with new, perhaps more specialized, inputs.
For generalization, we can use [`Data.Just`](@ref) to pass our `add` function to the generalized properties.

!!! note "Nesting @testset"
From Julia 1.11 onwards, `@check` can also report its own results as part of a parent `@testset`.
This is unfortunately unsupported on 1.10 and earlier.

Be aware that while all checks pass, we _do not have a guarantee that our code is correct for all cases_.
Sampling elements to test is a statistical process and as such we can only gain _confidence_ that our code
is correct. You may view this in the light of Bayesian statistics, where we update our prior that the code
Expand Down

0 comments on commit c476a53

Please sign in to comment.