Skip to content

Commit 6f1995d

Browse files
committed
Tests to ensure no interference with SaferIntegers
1 parent 63314b2 commit 6f1995d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ julia = "1"
88

99
[extras]
1010
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
11+
SaferIntegers = "88634af6-177f-5301-88b8-7819386cfa38"
1112

1213
[targets]
13-
test = ["Test"]
14+
test = ["Test", "SaferIntegers"]

test/runtests.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,16 @@ end
288288
@test @unchecked(1 + 4 + 5 + typemax(Int)) == 10 + typemax(Int)
289289
@test @checked(1.0 + 4 + 5 + typemax(Int)) == 9.223372036854776e18
290290
end
291+
292+
using SaferIntegers
293+
294+
@testset "Ensure SaferIntegers are still safer" begin
295+
@test_throws OverflowError typemax(SafeInt) + 1
296+
@test_throws OverflowError @unchecked typemax(SafeInt) + 1
297+
(@__MODULE__).eval(:(
298+
module UncheckedDefaultSaferIntStillChecksModule
299+
using OverflowContexts, SaferIntegers, Test
300+
@default_unchecked
301+
@test_throws OverflowError typemax(SafeInt) + 1
302+
end))
303+
end

0 commit comments

Comments
 (0)