mirror of
https://github.com/sbrow/zomq.git
synced 2026-08-26 10:53:32 -04:00
test: Migrated custom test to proper test.
This commit is contained in:
@@ -16,6 +16,7 @@ test_version :: proc(t: ^testing.T) {
|
||||
|
||||
@(test)
|
||||
test_connect_does_not_allocate_with_string_literals :: proc(t: ^testing.T) {
|
||||
context.allocator = runtime.panic_allocator()
|
||||
context.temp_allocator = runtime.panic_allocator()
|
||||
|
||||
ctx := ctx_new()
|
||||
@@ -115,3 +116,34 @@ test_simple_const_echo :: proc(t: ^testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_duplicate_bind_fails :: proc(t: ^testing.T) {
|
||||
ctx := ctx_new()
|
||||
defer ctx_term(ctx)
|
||||
|
||||
rep1, serr := socket(ctx, .REP)
|
||||
testing.expect_value(t, serr, nil)
|
||||
if serr != nil {
|
||||
testing.fail_now(t, "create first socket")
|
||||
}
|
||||
defer close(rep1)
|
||||
|
||||
if berr := bind(rep1, "inproc://duplicate"); berr != nil {
|
||||
testing.expect_value(t, berr, nil)
|
||||
testing.fail_now(t, "first bind should succeed")
|
||||
}
|
||||
|
||||
rep2, cerr := socket(ctx, .REP)
|
||||
testing.expect_value(t, cerr, nil)
|
||||
if cerr != nil {
|
||||
testing.fail_now(t, "create second socket")
|
||||
}
|
||||
defer close(rep2)
|
||||
|
||||
if berr := bind(rep2, "inproc://duplicate"); berr == nil {
|
||||
testing.fail_now(t, "second bind to same endpoint should fail with EADDRINUSE")
|
||||
} else {
|
||||
testing.expect_value(t, berr, ZMQ_Error.EADDRINUSE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user