|
173 | 173 | # This set tests that we haven't accidentally added or removed any public-looking |
174 | 174 | # functions (i.e. ones that are not prefixed by _ basically). |
175 | 175 | @testset "Public API" begin |
176 | | - public_symbols = Set( |
177 | | - filter(names(JuliaHub; all=true)) do s |
178 | | - # Internal functions and types, prefixed by _ |
179 | | - startswith(string(s), "_") && return false |
180 | | - # Internal macros, prefixed by _ |
181 | | - startswith(string(s), "@_") && return false |
182 | | - # Strange generated functions |
183 | | - startswith(string(s), "#") && return false |
184 | | - # Some core functions that are not relevant for the package |
185 | | - s in [:eval, :include] && return false |
186 | | - return true |
187 | | - end, |
188 | | - ) |
| 176 | + public_symbols = Set(JuliaHub._find_public_names()) |
189 | 177 | expected_public_symbols = Set([ |
190 | 178 | Symbol("@script_str"), |
191 | 179 | :AbstractJobConfig, :AbstractJuliaHubApp, |
|
223 | 211 | extra_expected_symbols = $(sprint(show, MIME"text/plain"(), extra_expected_symbols)) |
224 | 212 | """ |
225 | 213 | @test isempty(extra_expected_symbols) |
| 214 | + # Make sure that on Julia versions that support the `public` keyword, |
| 215 | + # we are also marking the right symbols as public. |
| 216 | + if Base.isdefined(Base, :ispublic) |
| 217 | + @testset "ispublic" begin |
| 218 | + for name in public_symbols |
| 219 | + @test Base.ispublic(JuliaHub, name) |
| 220 | + end |
| 221 | + for name in setdiff(names(JuliaHub; all=true), public_symbols) |
| 222 | + @test !Base.ispublic(JuliaHub, name) |
| 223 | + end |
| 224 | + end |
| 225 | + end |
226 | 226 | end |
227 | 227 |
|
228 | 228 | @testset "Utilities" begin |
|
0 commit comments