Skip to content

Commit

Permalink
move generated docs test to other file
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Jun 30, 2024
1 parent 6ab91f9 commit e691b26
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
42 changes: 1 addition & 41 deletions test/advanced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,45 +103,5 @@ using Test #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
include("test_generated_docs.jl") #src

## 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)
42 changes: 42 additions & 0 deletions test/test_generated_docs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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 e691b26

Please sign in to comment.