Skip to content

Commit 15b76b9

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

6 files changed

Lines changed: 36 additions & 31 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
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())'

Manifest.toml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Project.toml

Lines changed: 4 additions & 0 deletions
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+

test/APITest.jl

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/REQUIRE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
julia 0.6
2+
StrAPI

test/runtests.jl

Lines changed: 11 additions & 12 deletions
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)