Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FunctionWrappers = "1.1.2"
Mooncake = "0.5"
PrecompileTools = "1.1"
SafeTestsets = "0.1, 1"
SciMLTesting = "1"
SciMLTesting = "2.1"
Test = "1"
TruncatedStacktraces = "1.1"
julia = "1.10"
Expand Down
2 changes: 0 additions & 2 deletions test/Enzyme/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
FunctionWrappersWrappers = {path = "../.."}

[compat]
Enzyme = "0.13"
Expand Down
2 changes: 0 additions & 2 deletions test/Mooncake/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
FunctionWrappersWrappers = {path = "../.."}

[compat]
Mooncake = "0.5"
Expand Down
5 changes: 1 addition & 4 deletions test/nopre/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
FunctionWrappersWrappers = {path = "../.."}

[compat]
SafeTestsets = "0.0.1, 0.1"
SciMLTesting = "1"
SciMLTesting = "2.1"
Test = "1"
5 changes: 1 addition & 4 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
FunctionWrappersWrappers = {path = "../.."}

[compat]
Aqua = "0.8"
JET = "0.9, 0.10, 0.11"
SafeTestsets = "0.0.1, 0.1, 1"
SciMLTesting = "1.6"
SciMLTesting = "2.1"
Test = "1"
julia = "1.10"
60 changes: 2 additions & 58 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SciMLTesting, FunctionWrappersWrappers, Test
using SciMLTesting, FunctionWrappersWrappers
using JET

run_qa(
Expand All @@ -14,61 +14,5 @@ run_qa(
ignore = (:tail, :FunctionWrapper, Symbol("@truncate_stacktrace")),
),
),
api_docs_kwargs = (; rendered = true),
)

function public_api_names(mod::Module)
public_names = Set(Symbol.(names(mod; all = false, imported = false)))
if isdefined(Base, :ispublic)
for name in names(mod; all = true, imported = false)
Base.ispublic(mod, name) && push!(public_names, Symbol(name))
end
end
delete!(public_names, nameof(mod))
return sort!(collect(public_names))
end

function has_source_docstring(mod::Module, name::Symbol)
if isdefined(Docs, :hasdoc)
return Docs.hasdoc(mod, name)
end

obj = getproperty(mod, name)
(obj isa Function || obj isa Type) || return false
return !startswith(strip(string(Docs.doc(obj))), "No documentation found.")
end

function docs_include_public_api(mod::Module, public_names)
package_root = pkgdir(mod)
isnothing(package_root) && return false

docs_src = joinpath(package_root, "docs", "src")
isdir(docs_src) || return false

markdown = join(
read(path, String)
for path in readdir(docs_src; join = true) if endswith(path, ".md")
)
module_name = string(nameof(mod))
autodocs_pattern = Regex(
"```@autodocs[\\s\\S]*?Modules\\s*=\\s*\\[[^\\]]*\\b" *
module_name *
"\\b[^\\]]*\\]"
)
occursin(autodocs_pattern, markdown) && return true

docs_blocks = [match.match for match in eachmatch(r"```@docs[\s\S]*?```", markdown)]
return all(public_names) do name
any(block -> occursin(string(name), block), docs_blocks)
end
end

@testset "Public API documentation" begin
public_names = public_api_names(FunctionWrappersWrappers)
undocumented_names = filter(
name -> !has_source_docstring(FunctionWrappersWrappers, name),
public_names
)

@test isempty(undocumented_names)
@test docs_include_public_api(FunctionWrappersWrappers, public_names)
end
Loading