Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more Context and Message tests #246

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading