Skip to content

Commit 15b76b9

Browse files
committed
Use StrAPI instead of APITest to test api macro
1 parent ba65a08 commit 15b76b9

File tree

6 files changed

+36
-31
lines changed

6 files changed

+36
-31
lines changed

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ matrix:
2727

2828
## uncomment the following lines to override the default test script
2929
script:
30-
- julia -e 'if VERSION < v"0.7.0-DEV.5183"; Pkg.clone(pwd()); Pkg.test("ModuleInterfaceTools", coverage=true); else; using UUIDs; import Pkg; p = "Project.toml"; uuid = "5cb8414e-7aab-5a03-a681-351269c074bf"; write(p, replace(read(p, String), uuid => uuid4())); Pkg.instantiate(); push!(LOAD_PATH, "test"); Pkg.test(; coverage=true); end'
30+
- julia -e 'if VERSION < v"0.7.0-DEV.5183"; Pkg.clone(pwd()); Pkg.test("ModuleInterfaceTools", coverage=true); else; using UUIDs; import Pkg; p = "Project.toml"; uuid = "5cb8414e-7aab-5a03-a681-351269c074bf"; write(p, replace(read(p, String), uuid => uuid4())); Pkg.instantiate(); Pkg.test(; coverage=true); end'
3131
after_success:
3232
# push coverage results to Coveralls
3333
- julia -e 'cd(Pkg.dir("ModuleInterfaceTools")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'

Diff for: Manifest.toml

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1+
[[InteractiveUtils]]
2+
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
3+
4+
[[ModuleInterfaceTools]]
5+
deps = ["InteractiveUtils", "Test"]
6+
git-tree-sha1 = "cee1e40a47a60742a40287f3c1df6375e92e524c"
7+
uuid = "5cb8414e-7aab-5a03-a681-351269c074bf"
8+
version = "0.1.2"
9+
110
[[Pkg]]
211
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
312

13+
[[Random]]
14+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
15+
16+
[[StrAPI]]
17+
deps = ["InteractiveUtils", "ModuleInterfaceTools", "Pkg", "Random"]
18+
git-tree-sha1 = "b905011d68af46965c9e89594d7d217153a742e1"
19+
uuid = "69e7dfc3-c4d0-5e14-8d95-d6042a05b383"
20+
version = "0.1.2"
21+
422
[[Test]]
523
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

Diff for: Project.toml

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ version = "0.1.3"
99
[deps]
1010
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1111
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
12+
13+
[targets.test.deps]
14+
StrAPI = "69e7dfc3-c4d0-5e14-8d95-d6042a05b383"
15+

Diff for: test/APITest.jl

-18
This file was deleted.

Diff for: test/REQUIRE

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
julia 0.6
2+
StrAPI

Diff for: test/runtests.jl

+11-12
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ using ModuleInterfaceTools
55

66
@api test
77

8-
@api path (@static V6_COMPAT ? joinpath(Pkg.dir("ModuleInterfaceTools"), "test") : @__DIR__)
8+
@api extend StrAPI
99

10-
@api extend APITest
11-
12-
@api list APITest
10+
@api list StrAPI
1311

1412
@api def testcase begin
1513
myname = "Scott Paul Jones"
@@ -20,17 +18,18 @@ end
2018
@test myname == "Scott Paul Jones"
2119
end
2220

23-
myfunc(::AbstractFloat) = 3
21+
codepoints(x::Integer) = 1
22+
codepoints(x::Float64) = 2
2423

2524
@testset "Function extension" begin
26-
@test myfunc(1) == 1
27-
@test myfunc("foo") == 2
28-
@test myfunc(2.0) == 3
25+
@test typeof(codepoints("foo")) === CodePoints{String}
26+
@test codepoints(1) == 1
27+
@test codepoints(2.0) == 2
2928
end
3029

3130
@testset "API lists" begin
32-
@test APITest.__api__.mod == APITest
33-
@test Set(APITest.__api__.base) == Set([:nextind, :getindex, :setindex!])
34-
@test Set(APITest.__api__.public) == Set([:Foo])
35-
@test Set(APITest.__api__.public!) == Set([:myfunc])
31+
@test StrAPI.__api__.mod == StrAPI
32+
@test :split in Set(StrAPI.__api__.base)
33+
@test :encoding in Set(StrAPI.__api__.public!)
34+
@test :Direction in Set(StrAPI.__api__.public)
3635
end

0 commit comments

Comments
 (0)