Skip to content

Commit

Permalink
Use StrAPI instead of APITest to test api macro
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottPJones committed Jun 19, 2018
1 parent ba65a08 commit 15b76b9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ matrix:

## uncomment the following lines to override the default test script
script:
- 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'
- 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'
after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("ModuleInterfaceTools")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
Expand Down
18 changes: 18 additions & 0 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
[[InteractiveUtils]]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[ModuleInterfaceTools]]
deps = ["InteractiveUtils", "Test"]
git-tree-sha1 = "cee1e40a47a60742a40287f3c1df6375e92e524c"
uuid = "5cb8414e-7aab-5a03-a681-351269c074bf"
version = "0.1.2"

[[Pkg]]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Random]]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[StrAPI]]
deps = ["InteractiveUtils", "ModuleInterfaceTools", "Pkg", "Random"]
git-tree-sha1 = "b905011d68af46965c9e89594d7d217153a742e1"
uuid = "69e7dfc3-c4d0-5e14-8d95-d6042a05b383"
version = "0.1.2"

[[Test]]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4 changes: 4 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ version = "0.1.3"
[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets.test.deps]
StrAPI = "69e7dfc3-c4d0-5e14-8d95-d6042a05b383"

18 changes: 0 additions & 18 deletions test/APITest.jl

This file was deleted.

2 changes: 2 additions & 0 deletions test/REQUIRE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
julia 0.6
StrAPI
23 changes: 11 additions & 12 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ using ModuleInterfaceTools

@api test

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

@api extend APITest

@api list APITest
@api list StrAPI

@api def testcase begin
myname = "Scott Paul Jones"
Expand All @@ -20,17 +18,18 @@ end
@test myname == "Scott Paul Jones"
end

myfunc(::AbstractFloat) = 3
codepoints(x::Integer) = 1
codepoints(x::Float64) = 2

@testset "Function extension" begin
@test myfunc(1) == 1
@test myfunc("foo") == 2
@test myfunc(2.0) == 3
@test typeof(codepoints("foo")) === CodePoints{String}
@test codepoints(1) == 1
@test codepoints(2.0) == 2
end

@testset "API lists" begin
@test APITest.__api__.mod == APITest
@test Set(APITest.__api__.base) == Set([:nextind, :getindex, :setindex!])
@test Set(APITest.__api__.public) == Set([:Foo])
@test Set(APITest.__api__.public!) == Set([:myfunc])
@test StrAPI.__api__.mod == StrAPI
@test :split in Set(StrAPI.__api__.base)
@test :encoding in Set(StrAPI.__api__.public!)
@test :Direction in Set(StrAPI.__api__.public)
end

0 comments on commit 15b76b9

Please sign in to comment.