Skip to content

Commit

Permalink
add test for generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jun 29, 2024
1 parent a8f20e7 commit af4d916
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/advanced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,46 @@ using Test #src
@test Interfaces.test(Group.GroupInterface, Float64) #src
@test !Interfaces.test(Group.GroupInterface, Int, int_pairs) #src
@test_throws ArgumentError Interfaces.test(Group.GroupInterface, Float64, int_pairs) #src

# Test generated docs
expected_extended_help = """# Extended help
## Mandatory keys:
* `neutral_check`:
* neutral stable
* `multiplication_check`:
* multiplication stable
* `inversion_check`:
* inversion stable
* inversion works"""

@test strip(Interfaces.extended_help(Group.GroupInterface)) == strip(expected_extended_help)


expected_docs = """```
GroupInterface
```
An Interfaces.jl `Interface` with mandatory components `(:neutral_check, :multiplication_check, :inversion_check)` and optional components `()`.
A group is a set of elements with a neutral element where you can perform multiplications and inversions.
The conditions checking the interface accept an `Arguments` object with two fields named `x` and `y`. The type of the first field `x` must be the type you wish to declare as implementing `GroupInterface`.
# Extended help
## Mandatory keys:
* `neutral_check`:
* neutral stable
* `multiplication_check`:
* multiplication stable
* `inversion_check`:
* inversion stable
* inversion works"""

@test strip(string(@doc Group.GroupInterface)) == strip(expected_docs)

0 comments on commit af4d916

Please sign in to comment.