Skip to content

Commit

Permalink
Remove GPUArray test dep and bump Adapt (#133)
Browse files Browse the repository at this point in the history
* CompatHelper: bump compat for "Adapt" to "2.0"

* remove GPUArrays test dep

* format

* simpler adapt overload

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Pietro Vertechi and github-actions[bot] authored Jun 24, 2020
1 parent 6474eaf commit 55bc03f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[compat]
Adapt = "1"
Adapt = "1, 2"
DataAPI = "1"
Tables = "1"
julia = "1"

[extras]
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
WeakRefStrings = "ea10d353-3f73-51f8-a26c-33c1cb351aa5"

[targets]
test = ["Test", "GPUArrays", "OffsetArrays", "PooledArrays", "WeakRefStrings"]
test = ["Test", "OffsetArrays", "PooledArrays", "WeakRefStrings"]
9 changes: 6 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ using StructArrays: staticschema, iscompatible, _promote_typejoin, append!!
using OffsetArrays: OffsetArray
import Tables, PooledArrays, WeakRefStrings
using DataAPI: refarray, refvalue
using Adapt: adapt
import GPUArrays
using Adapt: adapt, Adapt
using Test

@testset "index" begin
Expand Down Expand Up @@ -702,9 +701,13 @@ end
end
end

struct ArrayConverter end

Adapt.adapt_storage(::ArrayConverter, xs::AbstractArray) = convert(Array, xs)

@testset "adapt" begin
s = StructArray(a = 1:10, b = StructArray(c = 1:10, d = 1:10))
t = adapt(Array, s)
t = adapt(ArrayConverter(), s)
@test propertynames(t) == (:a, :b)
@test s == t
@test t.a isa Array
Expand Down

0 comments on commit 55bc03f

Please sign in to comment.