From af4d916feb5a51e19fe1ca4f3f2495d67eb7e6df Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Sat, 29 Jun 2024 19:37:41 +0100 Subject: [PATCH] add test for generated docs --- test/advanced.jl | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/advanced.jl b/test/advanced.jl index 9d1e06f..51fed14 100644 --- a/test/advanced.jl +++ b/test/advanced.jl @@ -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)