Skip to content

Commit aa8e582

Browse files
committed
Test both URIParser and URIs
1 parent 3809382 commit aa8e582

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ URIParser = "30578b45-9adc-5946-b283-645ec420af67"
2626
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
2727

2828
[targets]
29-
test = ["Glob", "Test", "URIs"]
29+
test = ["Glob", "Test", "URIParser", "URIs"]

src/uriparser.jl

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using .URIParser
22

3-
Base.depwarn("`URIParser` is deprecated, use `URIs` instead.", :URIParser, force=true)
4-
53
function URIParser.URI(p::AbstractPath; query="", fragment="")
4+
Base.depwarn("`URIParser` is deprecated, use `URIs` instead.", :URIParser)
65
if isempty(p.root)
76
throw(ArgumentError("$p is not an absolute path"))
87
end

test/test_uri.jl

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1+
using URIParser
12
using URIs
23
using FilePaths
34

4-
@testset "URI" begin
5-
@test string(URI(p"/foo/bar")) == "file:///foo/bar"
6-
@test string(URI(p"/foo foo/bar")) == "file:///foo%20foo/bar"
7-
@test_throws ArgumentError URI(p"foo/bar")
8-
@test string(URI(WindowsPath("C:\\foo\\bar"))) == "file:///C:/foo/bar"
9-
@test string(URI(p"/foo/bar", query="querypart", fragment="fragmentpart")) == "file:///foo/bar?querypart#fragmentpart"
5+
@testset "URIParser" begin
6+
@test string(URIParser.URI(p"/foo/bar")) == "file:///foo/bar"
7+
@test string(URIParser.URI(p"/foo foo/bar")) == "file:///foo%20foo/bar"
8+
@test_throws ArgumentError URIParser.URI(p"foo/bar")
9+
@test string(URIParser.URI(WindowsPath("C:\\foo\\bar"))) == "file:///C:/foo/bar"
10+
@test string(URIParser.URI(p"/foo/bar", query="querypart", fragment="fragmentpart")) == "file:///foo/bar?querypart#fragmentpart"
11+
end
12+
13+
@testset "URIs" begin
14+
@test string(URIs.URI(p"/foo/bar")) == "file:///foo/bar"
15+
@test string(URIs.URI(p"/foo foo/bar")) == "file:///foo%20foo/bar"
16+
@test_throws ArgumentError URIs.URI(p"foo/bar")
17+
@test string(URIs.URI(WindowsPath("C:\\foo\\bar"))) == "file:///C:/foo/bar"
18+
@test string(URIs.URI(p"/foo/bar", query="querypart", fragment="fragmentpart")) == "file:///foo/bar?querypart#fragmentpart"
1019
end

0 commit comments

Comments
 (0)