Skip to content

Commit

Permalink
Add more Context and Message tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWrigley committed Jul 15, 2024
1 parent d3cf3cb commit de48c57
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit de48c57

Please sign in to comment.