Skip to content

Commit 6da5a80

Browse files
committed
Fix tests in Julia 1.10
1 parent e3cd93b commit 6da5a80

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/test_diagonal.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ using SparseArraysBase:
1111

1212
using Test: @test, @testset
1313

14+
# compat with LTS:
15+
@static if VERSION v"1.11"
16+
_diagind = diagind
17+
else
18+
function _diagind(x::Diagonal, ::IndexCartesian)
19+
return view(CartesianIndices(x), diagind(x))
20+
end
21+
end
22+
1423
elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
1524

1625
@testset "Diagonal{$T}" for T in elts
1726
L = 4
1827
D = Diagonal(rand(T, 4))
1928
@test storedlength(D) == 4
20-
@test eachstoredindex(D) == diagind(D, IndexCartesian())
29+
@test eachstoredindex(D) == _diagind(D, IndexCartesian())
2130
@test isstored(D, 2, 2)
2231
@test getstoredindex(D, 2, 2) == D[2, 2]
2332
@test !isstored(D, 2, 1)

0 commit comments

Comments
 (0)