|
1 | 1 | using Test, HTTP, JSON
|
2 | 2 |
|
| 3 | +# Using this rather than @__DIR__ because then it's easier to run parts of the |
| 4 | +# file at the REPL, which is convenient when developing the package. |
3 | 5 | const dir = joinpath(dirname(pathof(HTTP)), "..", "test")
|
4 | 6 |
|
| 7 | +# See https://httpbingo.julialang.org/ |
5 | 8 | const httpbin = get(ENV, "JULIA_TEST_HTTPBINGO_SERVER", "httpbingo.julialang.org")
|
6 | 9 |
|
| 10 | +# A convenient test helper used in a few test files. |
7 | 11 | isok(r) = r.status == 200
|
8 | 12 |
|
9 |
| -include(joinpath(dir, "resources/TestRequest.jl")) |
10 | 13 | @testset "HTTP" begin
|
11 |
| - for f in [ |
12 |
| - "ascii.jl", |
13 |
| - "chunking.jl", |
14 |
| - "utils.jl", |
15 |
| - "client.jl", |
16 |
| - # "download.jl", |
17 |
| - "multipart.jl", |
18 |
| - "parsemultipart.jl", |
19 |
| - "sniff.jl", |
20 |
| - "cookies.jl", |
21 |
| - "parser.jl", |
22 |
| - "loopback.jl", |
23 |
| - "websockets/deno_client/server.jl", |
24 |
| - "messages.jl", |
25 |
| - "handlers.jl", |
26 |
| - "server.jl", |
27 |
| - "async.jl", |
28 |
| - "mwe.jl", |
29 |
| - "httpversion.jl", |
30 |
| - "websockets/autobahn.jl", |
31 |
| - ] |
32 |
| - file = joinpath(dir, f) |
33 |
| - println("Running $file tests...") |
34 |
| - if isfile(file) |
35 |
| - include(file) |
36 |
| - else |
37 |
| - @show readdir(dirname(file)) |
38 |
| - end |
| 14 | + testfiles = [ |
| 15 | + "ascii.jl", |
| 16 | + "chunking.jl", |
| 17 | + "utils.jl", |
| 18 | + "client.jl", |
| 19 | + # "download.jl", |
| 20 | + "multipart.jl", |
| 21 | + "parsemultipart.jl", |
| 22 | + "sniff.jl", |
| 23 | + "cookies.jl", |
| 24 | + "parser.jl", |
| 25 | + "loopback.jl", |
| 26 | + "websockets/deno_client/server.jl", |
| 27 | + "messages.jl", |
| 28 | + "handlers.jl", |
| 29 | + "server.jl", |
| 30 | + "async.jl", |
| 31 | + "mwe.jl", |
| 32 | + "httpversion.jl", |
| 33 | + "websockets/autobahn.jl", |
| 34 | + ] |
| 35 | + # ARGS can be most easily passed like this: |
| 36 | + # import Pkg; Pkg.test("HTTP"; test_args=`ascii.jl parser.jl`) |
| 37 | + if !isempty(ARGS) |
| 38 | + filter!(in(ARGS), testfiles) |
| 39 | + end |
| 40 | + for filename in testfiles |
| 41 | + println("Running $filename tests...") |
| 42 | + include(joinpath(dir, filename)) |
39 | 43 | end
|
40 | 44 | end
|
0 commit comments