MCPcopy
hub / github.com/nats-io/nats.go / TestEncBuiltinConstructorErrs

Function TestEncBuiltinConstructorErrs

test/enc_test.go:40–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestEncBuiltinConstructorErrs(t *testing.T) {
41 s := RunServerOnPort(TEST_PORT)
42 defer s.Shutdown()
43
44 c := NewConnection(t, TEST_PORT)
45 _, err := nats.NewEncodedConn(nil, "default")
46 if err == nil {
47 t.Fatal("Expected err for nil connection")
48 }
49 _, err = nats.NewEncodedConn(c, "foo22")
50 if err == nil {
51 t.Fatal("Expected err for bad encoder")
52 }
53 c.Close()
54 _, err = nats.NewEncodedConn(c, "default")
55 if err == nil {
56 t.Fatal("Expected err for closed connection")
57 }
58
59}
60
61func TestEncBuiltinMarshalString(t *testing.T) {
62 s := RunServerOnPort(TEST_PORT)

Callers

nothing calls this directly

Calls 3

RunServerOnPortFunction · 0.70
NewConnectionFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected