From 7824f5640fd3938b2d6edf3e68a6472c6a9837a4 Mon Sep 17 00:00:00 2001 From: Carlo Lucibello Date: Tue, 12 Oct 2021 16:51:37 +0200 Subject: [PATCH 1/3] functor RefValue --- src/Functors.jl | 1 + src/base.jl | 1 + test/base.jl | 8 ++++++++ test/runtests.jl | 1 + 4 files changed, 11 insertions(+) create mode 100644 src/base.jl create mode 100644 test/base.jl diff --git a/src/Functors.jl b/src/Functors.jl index 54527a3..ae09d9d 100644 --- a/src/Functors.jl +++ b/src/Functors.jl @@ -3,5 +3,6 @@ module Functors export @functor, @flexiblefunctor, fmap, fmapstructure, fcollect include("functor.jl") +include("base.jl") end # module diff --git a/src/base.jl b/src/base.jl new file mode 100644 index 0000000..8a90dc6 --- /dev/null +++ b/src/base.jl @@ -0,0 +1 @@ +@functor Base.RefValue diff --git a/test/base.jl b/test/base.jl new file mode 100644 index 0000000..7944efa --- /dev/null +++ b/test/base.jl @@ -0,0 +1,8 @@ +@testset "Base" begin + @testset "RefValue" begin + x = Ref(1) + p, re = functor(x) + @test p == (x = 1,) + @test re(p) isa Base.RefValue{Int} + end +end diff --git a/test/runtests.jl b/test/runtests.jl index d824e63..4ccc029 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,5 +3,6 @@ using Functors, Test @testset "Functors.jl" begin include("basics.jl") +include("base.jl") end From 281b60ef7f3811a347ec386e7f88c83aca154e07 Mon Sep 17 00:00:00 2001 From: Carlo Lucibello Date: Tue, 12 Oct 2021 16:52:26 +0200 Subject: [PATCH 2/3] bump compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index b1bc07e..ca2aa59 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Functors" uuid = "d9f16b24-f501-4c13-a1f2-28368ffc5196" authors = ["Mike J Innes "] -version = "0.2.6" +version = "0.2.7" [compat] julia = "1" From 3bc769456987800ca854da5b662c672cb9261684 Mon Sep 17 00:00:00 2001 From: Carlo Lucibello Date: Tue, 12 Oct 2021 17:00:09 +0200 Subject: [PATCH 3/3] fix --- test/base.jl | 2 +- test/basics.jl | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/test/base.jl b/test/base.jl index 7944efa..30c4598 100644 --- a/test/base.jl +++ b/test/base.jl @@ -1,7 +1,7 @@ @testset "Base" begin @testset "RefValue" begin x = Ref(1) - p, re = functor(x) + p, re = Functors.functor(x) @test p == (x = 1,) @test re(p) isa Base.RefValue{Int} end diff --git a/test/basics.jl b/test/basics.jl index 9d1ce76..21aa445 100644 --- a/test/basics.jl +++ b/test/basics.jl @@ -1,5 +1,3 @@ -using Functors, Test - struct Foo x y