diff --git a/test/runtests.jl b/test/runtests.jl
index 906ec15f8b29ea39d1416286715e93bda9e0de79..f91f8793f73346eee940d74ae28ab3faf7ab74ca 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -28,3 +28,24 @@ Random.seed!(0)
 
     @test img == img_sampled
 end
+
+@testset "mesh refinement" begin
+    # simple hashing
+    val(f) = integrate(f.space.mesh, (x; f) -> dot(f, f); f)
+
+    mesh = init_grid(zeros(5, 5))
+
+    f = FeFunction(FeSpace(mesh, P1(), (2, 3)))
+    f.data .= rand(size(f.data)...)
+
+    for i = 1:2
+        # refine roughly half of all cells
+        cells_ref = Set(findall(_ -> rand(Bool), cells(mesh)))
+
+        mesh_new, (f_new,) = refine(mesh, cells_ref; f)
+
+        @test isapprox(val(f), val(f_new))
+
+        (mesh, f) = (mesh_new, f_new)
+    end
+end