Skip to content

Commit

Permalink
Test: unexport guardsrand (JuliaLang#27942)
Browse files Browse the repository at this point in the history
This is mostly superseded by the new behavior of at-testset,
which reinitializes the state of the GLOBAL_RNG.
  • Loading branch information
rfourquet committed Jul 7, 2018
1 parent 906f427 commit 069314b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions stdlib/Random/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Test, SparseArrays
using Test: guardsrand

const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
isdefined(Main, :TestHelpers) || @eval Main include(joinpath($(BASE_TEST_PATH), "TestHelpers.jl"))
Expand Down
1 change: 1 addition & 0 deletions stdlib/SparseArrays/test/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using SparseArrays
using LinearAlgebra
using Base.Printf: @printf
using Random
using Test: guardsrand

@testset "issparse" begin
@test issparse(sparse(fill(1,5,5)))
Expand Down
1 change: 1 addition & 0 deletions stdlib/Statistics/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Statistics, Test, Random, LinearAlgebra, SparseArrays
using Test: guardsrand

@testset "middle" begin
@test middle(3) === 3.0
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Test/src/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export @testset
export @inferred
export detect_ambiguities, detect_unbound_args
export GenericString, GenericSet, GenericDict, GenericArray
export guardsrand, TestSetException
export TestSetException

import Distributed: myid

Expand Down
1 change: 1 addition & 0 deletions stdlib/Test/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Test, Distributed, Random
using Test: guardsrand

import Logging: Debug, Info, Warn

Expand Down
2 changes: 1 addition & 1 deletion test/error.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@test maximum(ExponentialBackOff(n=10, max_delay=0.06)) == 0.06
ratio(x) = x[2:end]./x[1:end-1]
@test all(x->x 10.0, ratio(collect(ExponentialBackOff(n=10, max_delay=Inf, factor=10, jitter=0.0))))
guardsrand(12345) do
Test.guardsrand(12345) do
x = ratio(collect(ExponentialBackOff(n=100, max_delay=Inf, factor=1, jitter=0.1)))
xm = sum(x) / length(x)
@test (xm - 1.0) < 1e-4
Expand Down

0 comments on commit 069314b

Please sign in to comment.