From de48c57d3cab9a113d983eac1d98f52d4341392d Mon Sep 17 00:00:00 2001 From: JamesWrigley Date: Mon, 15 Jul 2024 21:52:52 +0200 Subject: [PATCH] Add more Context and Message tests --- test/runtests.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 0ef7c70..e50ba32 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,10 +6,18 @@ using ZMQ, Test @testset "ZMQ contexts" begin ctx=Context() @test ctx isa Context + @test propertynames(ctx) isa Tuple + + @test_logs (:warn, r"set(.+) is deprecated") ZMQ.set(ctx, ZMQ.IO_THREADS, 3) + @test (@test_logs (:warn, r"get(.+) is deprecated") get(ctx, ZMQ.IO_THREADS)) == 3 + @test (ctx.io_threads = 2) == 2 @test ctx.io_threads == 2 ZMQ.close(ctx) + @test_throws StateError ctx.io_threads = 1 + @test_throws StateError ctx.io_threads + #try to create socket with expired context @test_throws StateError Socket(ctx, PUB) end @@ -197,6 +205,14 @@ end m = Message(10) @test_throws BoundsError m[0] @test_throws BoundsError m[11] + @test_throws BoundsError m[0] = 1 + @test_throws BoundsError m[11] = 1 + + @test propertynames(m) isa Tuple + @test_logs (:warn, r"set(.+) is deprecated") (@test_throws StateError ZMQ.set(m, ZMQ.MORE, 1)) + @test (@test_logs (:warn, r"get(.+) is deprecated") get(m, ZMQ.MORE)) == 0 + @test_throws ErrorException m.foo + @test_throws ErrorException m.more = 1 # Smoke tests @test !Bool(m.more)