|
225 | 225 | end |
226 | 226 | @test isfile(out) |
227 | 227 | end |
| 228 | + |
| 229 | +@testset "path_filterer" begin |
| 230 | + @testset "subdirectory" begin |
| 231 | + dir = joinpath(@__DIR__, "fixtures", "ignorefiles") |
| 232 | + pred = JuliaHub._PackageBundler.path_filterer(dir) |
| 233 | + @test pred(joinpath(dir, "Pkg3", "README.md")) |
| 234 | + |
| 235 | + @test pred(joinpath(dir, "Pkg3", "src", "bar")) |
| 236 | + @test !pred(joinpath(dir, "Pkg3", "src", "foo")) |
| 237 | + @test pred(joinpath(dir, "Pkg3", "src", "fooo")) |
| 238 | + |
| 239 | + @test !pred(joinpath(dir, "Pkg3", "test", "bar")) |
| 240 | + @test !pred(joinpath(dir, "Pkg3", "test", "foo")) |
| 241 | + @test pred(joinpath(dir, "Pkg3", "test", "fooo", "test")) |
| 242 | + |
| 243 | + # Note: even though the test/foo and test/bar directories are |
| 244 | + # excluded, the predicate function does not return false if you |
| 245 | + # check for file within the directories. |
| 246 | + @test pred(joinpath(dir, "Pkg3", "test", "bar", "test")) |
| 247 | + @test pred(joinpath(dir, "Pkg3", "test", "foo", "test")) |
| 248 | + end |
| 249 | + @testset "toplevel" begin |
| 250 | + dir = joinpath(@__DIR__, "fixtures", "ignorefiles", "Pkg3") |
| 251 | + pred = JuliaHub._PackageBundler.path_filterer(dir) |
| 252 | + @test pred(joinpath(dir, "README.md")) |
| 253 | + |
| 254 | + @test pred(joinpath(dir, "src", "bar")) |
| 255 | + @test !pred(joinpath(dir, "src", "foo")) |
| 256 | + @test pred(joinpath(dir, "src", "fooo")) |
| 257 | + |
| 258 | + @test !pred(joinpath(dir, "test", "bar")) |
| 259 | + @test !pred(joinpath(dir, "test", "foo")) |
| 260 | + @test pred(joinpath(dir, "test", "fooo", "test")) |
| 261 | + |
| 262 | + # Note: even though the test/foo and test/bar directories are |
| 263 | + # excluded, the predicate function does not return false if you |
| 264 | + # check for file within the directories. |
| 265 | + @test pred(joinpath(dir, "test", "bar", "test")) |
| 266 | + @test pred(joinpath(dir, "test", "foo", "test")) |
| 267 | + end |
| 268 | +end |
0 commit comments