11module DocumenterReferenceTestMod
22
3- """
4- Simple documented function used to test source file detection and inclusion.
5- """
6- myfun (x) = x
7-
8- """
9- Function that should be kept by _iterate_over_symbols.
10- """
11- keep (x) = x
12-
13- """
14- Function that will be excluded via the `exclude` configuration.
15- """
16- skip (x) = x
17-
18- # No docstring: this function should be skipped by _iterate_over_symbols.
19- no_doc (x) = x
20-
21- """
22- Test submodule with a docstring but no associated source file information.
23- Used to exercise include_without_source behaviour for modules.
24- """
25- module SubModule
26- end
27-
28- abstract type AbstractFoo end
29-
30- struct Foo <: AbstractFoo
31- x:: Int
32- end
3+ """
4+ Simple documented function used to test source file detection and inclusion.
5+ """
6+ myfun (x) = x
7+
8+ """
9+ Function that should be kept by _iterate_over_symbols.
10+ """
11+ keep (x) = x
12+
13+ """
14+ Function that will be excluded via the `exclude` configuration.
15+ """
16+ skip (x) = x
17+
18+ # No docstring: this function should be skipped by _iterate_over_symbols.
19+ no_doc (x) = x
20+
21+ """
22+ Test submodule with a docstring but no associated source file information.
23+ Used to exercise include_without_source behaviour for modules.
24+ """
25+ module SubModule end
26+
27+ abstract type AbstractFoo end
28+
29+ struct Foo <: AbstractFoo
30+ x:: Int
31+ end
3332
34- const MYCONST = 42
33+ const MYCONST = 42
3534
3635end
3736
@@ -57,13 +56,17 @@ function test_documenter_reference()
5756 end
5857
5958 @testset " _classify_symbol and _to_string" begin
60-
6159 @test DR. _classify_symbol (nothing , " @mymacro" ) == DR. DOCTYPE_MACRO
62- @test DR. _classify_symbol (DocumenterReferenceTestMod. SubModule, " SubModule" ) == DR. DOCTYPE_MODULE
63- @test DR. _classify_symbol (DocumenterReferenceTestMod. AbstractFoo, " AbstractFoo" ) == DR. DOCTYPE_ABSTRACT_TYPE
64- @test DR. _classify_symbol (DocumenterReferenceTestMod. Foo, " Foo" ) == DR. DOCTYPE_STRUCT
65- @test DR. _classify_symbol (DocumenterReferenceTestMod. myfun, " myfun" ) == DR. DOCTYPE_FUNCTION
66- @test DR. _classify_symbol (DocumenterReferenceTestMod. MYCONST, " MYCONST" ) == DR. DOCTYPE_CONSTANT
60+ @test DR. _classify_symbol (DocumenterReferenceTestMod. SubModule, " SubModule" ) ==
61+ DR. DOCTYPE_MODULE
62+ @test DR. _classify_symbol (DocumenterReferenceTestMod. AbstractFoo, " AbstractFoo" ) ==
63+ DR. DOCTYPE_ABSTRACT_TYPE
64+ @test DR. _classify_symbol (DocumenterReferenceTestMod. Foo, " Foo" ) ==
65+ DR. DOCTYPE_STRUCT
66+ @test DR. _classify_symbol (DocumenterReferenceTestMod. myfun, " myfun" ) ==
67+ DR. DOCTYPE_FUNCTION
68+ @test DR. _classify_symbol (DocumenterReferenceTestMod. MYCONST, " MYCONST" ) ==
69+ DR. DOCTYPE_CONSTANT
6770
6871 @test DR. _to_string (DR. DOCTYPE_ABSTRACT_TYPE) == " abstract type"
6972 @test DR. _to_string (DR. DOCTYPE_CONSTANT) == " constant"
@@ -77,7 +80,9 @@ function test_documenter_reference()
7780 path = DR. _get_source_file (DocumenterReferenceTestMod, :myfun , DR. DOCTYPE_FUNCTION)
7881 @test path === abspath (@__FILE__ )
7982
80- const_path = DR. _get_source_file (DocumenterReferenceTestMod, :MYCONST , DR. DOCTYPE_CONSTANT)
83+ const_path = DR. _get_source_file (
84+ DocumenterReferenceTestMod, :MYCONST , DR. DOCTYPE_CONSTANT
85+ )
8186 @test const_path === nothing
8287 end
8388
@@ -143,9 +148,7 @@ function test_documenter_reference()
143148 Module[],
144149 )
145150
146- symbols1 = [
147- :myfun => DR. DOCTYPE_FUNCTION,
148- ]
151+ symbols1 = [:myfun => DR. DOCTYPE_FUNCTION]
149152
150153 seen1 = Symbol[]
151154 DR. _iterate_over_symbols (config1, symbols1) do key, type
@@ -186,9 +189,7 @@ function test_documenter_reference()
186189 Module[],
187190 )
188191
189- symbols_module = [
190- :SubModule => DR. DOCTYPE_MODULE,
191- ]
192+ symbols_module = [:SubModule => DR. DOCTYPE_MODULE]
192193
193194 seen2 = Symbol[]
194195 DR. _iterate_over_symbols (config2, symbols_module) do key, type
@@ -242,10 +243,8 @@ function test_documenter_reference()
242243 @test cfg2. public == true
243244 @test cfg2. private == true
244245 @test cfg2. title == " All API"
245- @test pages2 == (" All API" => [
246- " Public" => " ref/public.md" ,
247- " Private" => " ref/private.md" ,
248- ])
246+ @test pages2 ==
247+ (" All API" => [" Public" => " ref/public.md" , " Private" => " ref/private.md" ])
249248
250249 # public=false, private=false should error
251250 @test_throws ErrorException CTBase. automatic_reference_documentation (
@@ -328,25 +327,36 @@ function test_documenter_reference()
328327
329328 @testset " _get_source_file expanded cases" begin
330329 # Function case (already tested, but verify)
331- func_path = DR. _get_source_file (DocumenterReferenceTestMod, :myfun , DR. DOCTYPE_FUNCTION)
330+ func_path = DR. _get_source_file (
331+ DocumenterReferenceTestMod, :myfun , DR. DOCTYPE_FUNCTION
332+ )
332333 @test func_path != = nothing
333334 @test endswith (func_path, " test_documenter_reference.jl" )
334335
335336 # Struct case - should find source via constructor methods
336- struct_path = DR. _get_source_file (DocumenterReferenceTestMod, :Foo , DR. DOCTYPE_STRUCT)
337+ struct_path = DR. _get_source_file (
338+ DocumenterReferenceTestMod, :Foo , DR. DOCTYPE_STRUCT
339+ )
337340 # Structs defined in test file should be found
338- @test struct_path === nothing || endswith (struct_path, " test_documenter_reference.jl" )
341+ @test struct_path === nothing ||
342+ endswith (struct_path, " test_documenter_reference.jl" )
339343
340344 # Abstract type case - typically returns nothing (no constructor)
341- abstract_path = DR. _get_source_file (DocumenterReferenceTestMod, :AbstractFoo , DR. DOCTYPE_ABSTRACT_TYPE)
345+ abstract_path = DR. _get_source_file (
346+ DocumenterReferenceTestMod, :AbstractFoo , DR. DOCTYPE_ABSTRACT_TYPE
347+ )
342348 @test abstract_path === nothing
343349
344350 # Module case - modules cannot reliably determine source
345- mod_path = DR. _get_source_file (DocumenterReferenceTestMod, :SubModule , DR. DOCTYPE_MODULE)
351+ mod_path = DR. _get_source_file (
352+ DocumenterReferenceTestMod, :SubModule , DR. DOCTYPE_MODULE
353+ )
346354 @test mod_path === nothing
347355
348356 # Constant case (already tested)
349- const_path = DR. _get_source_file (DocumenterReferenceTestMod, :MYCONST , DR. DOCTYPE_CONSTANT)
357+ const_path = DR. _get_source_file (
358+ DocumenterReferenceTestMod, :MYCONST , DR. DOCTYPE_CONSTANT
359+ )
350360 @test const_path === nothing
351361 end
352362
@@ -403,4 +413,4 @@ function test_documenter_reference()
403413 DR. reset_config! ()
404414 @test isempty (DR. CONFIG)
405415 end
406- end
416+ end
0 commit comments