From 50b174f4b09dbb25d49a190309f684523c2514b4 Mon Sep 17 00:00:00 2001 From: mfgnik Date: Fri, 3 Apr 2020 00:15:41 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82,=20=D1=83=D0=BF=D1=80=D0=BE=D1=89?= =?UTF-8?q?=D0=B0=D1=8E=D1=89=D0=B8=D0=B9=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=20=D0=B1=D0=B0=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- batcher/batcher_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/batcher/batcher_test.go b/batcher/batcher_test.go index b1bbcf7..7f664b9 100644 --- a/batcher/batcher_test.go +++ b/batcher/batcher_test.go @@ -27,6 +27,18 @@ func TestSimple(t *testing.T) { require.Equal(t, 2, value.Load()) } +func TestTwoParallelLoads(t *testing.T) { + defer goleak.VerifyNone(t) + var value slow.Value + b := NewBatcher(&value) + + value.Store(1) + go func() { + require.Equal(t, 1, b.Load()) + }() + require.Equal(t, 1, b.Load()) +} + func TestStaleRead(t *testing.T) { defer goleak.VerifyNone(t)