Skip to content

Commit

Permalink
Merge pull request #19415 from JuliaLang/tk/misccleanups
Browse files Browse the repository at this point in the history
A few minor miscellaneous testing, doc, and deprecation cleanups
  • Loading branch information
tkelman authored Nov 29, 2016
2 parents 12cd3a6 + b1fd488 commit 0ba4ea7
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 75 deletions.
7 changes: 4 additions & 3 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ end
@deprecate chol(A::Number, ::Type{Val{:L}}) ctranspose(chol(A))
@deprecate chol(A::AbstractMatrix, ::Type{Val{:L}}) ctranspose(chol(A))

@deprecate cummin(A, dim=1) accumulate(min, A, dim=1)
@deprecate cummax(A, dim=1) accumulate(max, A, dim=1)


# Number updates

Expand Down Expand Up @@ -1133,4 +1130,8 @@ eval(Base.Dates, quote
recur{T<:TimeType}(fun::Function, start::T, stop::T; step::Period=Day(1), negate::Bool=false, limit::Int=10000) = recur(fun, start:step:stop; negate=negate)
end)

# #18931
@deprecate cummin(A, dim=1) accumulate(min, A, dim=1)
@deprecate cummax(A, dim=1) accumulate(max, A, dim=1)

# End deprecations scheduled for 0.6
4 changes: 2 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ default: all
ifeq ($(OS),WINNT)
ULIMIT_TEST=
else
ULIMIT_TEST=ulimit -n 128
ULIMIT_TEST=ulimit -n 128 &&
endif

$(TESTS):
@cd $(SRCDIR) && \
$(ULIMIT_TEST) && \
$(ULIMIT_TEST) \
$(call PRINT_JULIA, $(call spawn,$(JULIA_EXECUTABLE)) --check-bounds=yes --startup-file=no ./runtests.jl $@)

perf:
Expand Down
6 changes: 3 additions & 3 deletions test/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ if is_windows()
else
@test filesize(dir) > 0
end
now = time()
nowtime = time()
# Allow 10s skew in addition to the time it took us to actually execute this code
let skew = 10 + (now - starttime)
let skew = 10 + (nowtime - starttime)
mfile = mtime(file)
mdir = mtime(dir)
@test abs(now - mfile) <= skew && abs(now - mdir) <= skew && abs(mfile - mdir) <= skew
@test abs(nowtime - mfile) <= skew && abs(nowtime - mdir) <= skew && abs(mfile - mdir) <= skew
end
#@test Int(time()) >= Int(mtime(file)) >= Int(mtime(dir)) >= 0 # 1 second accuracy should be sufficient

Expand Down
18 changes: 9 additions & 9 deletions test/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,29 @@ end

# SSH URL using scp-like syntax
m = match(LibGit2.URL_REGEX, "user@server:project.git")
@test m[:scheme] == nothing
@test m[:scheme] === nothing
@test m[:user] == "user"
@test m[:password] == nothing
@test m[:password] === nothing
@test m[:host] == "server"
@test m[:port] == nothing
@test m[:port] === nothing
@test m[:path] == "project.git"

# Realistic example from GitHub using HTTPS
m = match(LibGit2.URL_REGEX, "https://github.com/JuliaLang/Example.jl.git")
@test m[:scheme] == "https"
@test m[:user] == nothing
@test m[:password] == nothing
@test m[:user] === nothing
@test m[:password] === nothing
@test m[:host] == "github.com"
@test m[:port] == nothing
@test m[:port] === nothing
@test m[:path] == "/JuliaLang/Example.jl.git"

# Realistic example from GitHub using SSH
m = match(LibGit2.URL_REGEX, "git@github.com:JuliaLang/Example.jl.git")
@test m[:scheme] == nothing
@test m[:scheme] === nothing
@test m[:user] == "git"
@test m[:password] == nothing
@test m[:password] === nothing
@test m[:host] == "github.com"
@test m[:port] == nothing
@test m[:port] === nothing
@test m[:path] == "JuliaLang/Example.jl.git"

# Make sure usernames can contain special characters
Expand Down
2 changes: 1 addition & 1 deletion test/parallel_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ function test_blas_config(pid, expected)
end

function test_add_procs_threaded_blas()
if get_num_threads() == nothing
if get_num_threads() === nothing
warn("Skipping blas num threads tests due to unsupported blas version")
return
end
Expand Down
4 changes: 2 additions & 2 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,11 @@ end
let
f18888() = return nothing
m = first(methods(f18888, Tuple{}))
@test m.specializations == nothing
@test m.specializations === nothing
ft = typeof(f18888)

code_typed(f18888, Tuple{}; optimize=false)
@test m.specializations != nothing # uncached, but creates the specializations entry
@test m.specializations !== nothing # uncached, but creates the specializations entry
code = Core.Inference.code_for_method(m, Tuple{ft}, Core.svec(), true)
@test !isdefined(code, :inferred)

Expand Down
110 changes: 55 additions & 55 deletions test/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,69 +105,69 @@ end
end
@testset "accounting" begin
local ts
try ts = @testset "outer" begin
@testset "inner1" begin
@test true
@test false
@test 1 == 1
@test 2 == :foo
@test 3 == 3
@testset "d" begin
@test 4 == 4
end
@testset begin
@test :blank != :notblank
try
ts = @testset "outer" begin
@testset "inner1" begin
@test true
@test false
@test 1 == 1
@test 2 == :foo
@test 3 == 3
@testset "d" begin
@test 4 == 4
end
@testset begin
@test :blank != :notblank
end
end
end
@testset "inner1" begin
@test 1 == 1
@test 2 == 2
@test 3 == :bar
@test 4 == 4
@test_throws ErrorException 1+1
@test_throws ErrorException error()
@test_throws RemoteException error()
@testset "errrrr" begin
@test "not bool"
@test error()
@testset "inner1" begin
@test 1 == 1
@test 2 == 2
@test 3 == :bar
@test 4 == 4
@test_throws ErrorException 1+1
@test_throws ErrorException error()
@test_throws RemoteException error()
@testset "errrrr" begin
@test "not bool"
@test error()
end

error("exceptions in testsets should be caught")
@test 1 == 1 # this test will not be run
end

error("exceptions in testsets should be caught")
@test 1 == 1 # this test will not be run
end

@testset "loop with desc" begin
@testset "loop1 $T" for T in (Float32, Float64)
@test 1 == T(1)
end
end
@testset "loops without desc" begin
@testset for T in (Float32, Float64)
@test 1 == T(1)
@testset "loop with desc" begin
@testset "loop1 $T" for T in (Float32, Float64)
@test 1 == T(1)
end
end
@testset for T in (Float32, Float64), S in (Int32,Int64)
@test S(1) == T(1)
@testset "loops without desc" begin
@testset for T in (Float32, Float64)
@test 1 == T(1)
end
@testset for T in (Float32, Float64), S in (Int32,Int64)
@test S(1) == T(1)
end
end
end
srand(123)
@testset "some loops fail" begin
@testset for i in 1:5
@test i <= rand(1:10)
end
# should add 3 errors and 3 passing tests
@testset for i in 1:6
iseven(i) || error("error outside of test")
@test true # only gets run if the above passed
srand(123)
@testset "some loops fail" begin
@testset for i in 1:5
@test i <= rand(1:10)
end
# should add 3 errors and 3 passing tests
@testset for i in 1:6
iseven(i) || error("error outside of test")
@test true # only gets run if the above passed
end
end
end
end
# These lines shouldn't be called
redirect_stdout(OLD_STDOUT)
error("No exception was thrown!")
# These lines shouldn't be called
error("No exception was thrown!")
catch ex
#redirect_stdout(OLD_STDOUT)
#redirect_stderr(OLD_STDERR)
#@show ex
redirect_stdout(OLD_STDOUT)
redirect_stderr(OLD_STDERR)
ex
end
@testset "ts results" begin
@test isa(ts, Test.DefaultTestSet)
Expand Down

0 comments on commit 0ba4ea7

Please sign in to comment.