Skip to content

Commit

Permalink
Fixed type-os and standardized some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkyV committed Dec 5, 2012
1 parent 8be7ce1 commit 3741a70
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 81 deletions.
4 changes: 2 additions & 2 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ func TestAuthServerStart(t *testing.T) {
func TestAuthConnectionFail(t *testing.T) {
_, err := Connect("nats://localhost:8222")
if err == nil {
t.Fatal("Should have gotten error trying to connect")
t.Fatal("Should have received an error while trying to connect")
}
}

func TestAuthConnectionSuccess(t *testing.T) {
nc, err := Connect("nats://derek:foo@localhost:8222")
if err != nil {
t.Fatal("Should have connected succesfully")
t.Fatal("Should have connected successfully")
}
nc.Close()
}
Expand Down
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type server struct {

var s *server

// So we can pass tests and benchmarks..
// So that we can pass tests and benchmarks...
type tLogger interface {
Fatalf(format string, args ...interface{})
Errorf(format string, args ...interface{})
Expand Down
2 changes: 1 addition & 1 deletion default_enc.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (je *DefaultEncoder) Encode(subject string, v interface{}) ([]byte, error)
}

func (je *DefaultEncoder) Decode(subject string, data []byte, vPtr interface{}) error {
// Figure out what its pointing to..
// Figure out what it's pointing to...
sData := *(*string)(unsafe.Pointer(&data))
switch arg := vPtr.(type) {
case *string:
Expand Down
4 changes: 2 additions & 2 deletions enc.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type EncodedConn struct {
Enc Encoder
}

// NewEncodedConn will wrap an existing Connection and utilize the appropriate registrered
// NewEncodedConn will wrap an existing Connection and utilize the appropriate registered
// encoder.
func NewEncodedConn(c *Conn, encType string) (*EncodedConn, error) {
if c == nil {
Expand Down Expand Up @@ -75,7 +75,7 @@ func (c *EncodedConn) Publish(subject string, v interface{}) error {
return c.Conn.publish(subject, _EMPTY_, b)
}

// PublishRequest will perform a Publish() excpecting a response on the
// PublishRequest will perform a Publish() expecting a response on the
// reply subject. Use Request() for automatically waiting for a response
// inline.
func (c *EncodedConn) PublishRequest(subject, reply string, v interface{}) error {
Expand Down
28 changes: 14 additions & 14 deletions enc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestMarshalString(t *testing.T) {

ec.Subscribe("enc_string", func(s string) {
if s != testString {
t.Fatalf("Got test string of '%s', wanted '%s'\n", s, testString)
t.Fatalf("Received test string of '%s', wanted '%s'\n", s, testString)
}
ch <- true
})
Expand All @@ -47,7 +47,7 @@ func TestMarshalBytes(t *testing.T) {

ec.Subscribe("enc_bytes", func(b []byte) {
if !bytes.Equal(b, testBytes) {
t.Fatalf("Got test bytes of '%s', wanted '%s'\n", b, testBytes)
t.Fatalf("Received test bytes of '%s', wanted '%s'\n", b, testBytes)
}
ch <- true
})
Expand All @@ -69,7 +69,7 @@ func TestMarshalInt(t *testing.T) {

ec.Subscribe("enc_int", func(n int) {
if n != testN {
t.Fatalf("Got test number of %d, wanted %d\n", n, testN)
t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
}
ch <- true
})
Expand All @@ -91,7 +91,7 @@ func TestMarshalInt32(t *testing.T) {

ec.Subscribe("enc_int", func(n int32) {
if n != int32(testN) {
t.Fatalf("Got test number of %d, wanted %d\n", n, testN)
t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
}
ch <- true
})
Expand All @@ -113,7 +113,7 @@ func TestMarshalInt64(t *testing.T) {

ec.Subscribe("enc_int", func(n int64) {
if n != int64(testN) {
t.Fatalf("Got test number of %d, wanted %d\n", n, testN)
t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
}
ch <- true
})
Expand All @@ -135,7 +135,7 @@ func TestMarshalFloat32(t *testing.T) {

ec.Subscribe("enc_float", func(n float32) {
if n != testN {
t.Fatalf("Got test number of %d, wanted %d\n", n, testN)
t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
}
ch <- true
})
Expand All @@ -157,7 +157,7 @@ func TestMarshalFloat64(t *testing.T) {

ec.Subscribe("enc_float", func(n float64) {
if n != testN {
t.Fatalf("Got test number of %d, wanted %d\n", n, testN)
t.Fatalf("Received test number of %d, wanted %d\n", n, testN)
}
ch <- true
})
Expand Down Expand Up @@ -201,10 +201,10 @@ func TestExtendedSubscribeCB(t *testing.T) {

ec.Subscribe(subject, func(subj, s string) {
if s != testString {
t.Fatalf("Got test string of '%s', wanted '%s'\n", s, testString)
t.Fatalf("Received test string of '%s', wanted '%s'\n", s, testString)
}
if subj != subject {
t.Fatalf("Got subject of '%s', wanted '%s'\n", subj, subject)
t.Fatalf("Received subject of '%s', wanted '%s'\n", subj, subject)
}
ch <- true
})
Expand All @@ -229,13 +229,13 @@ func TestExtendedSubscribeCB2(t *testing.T) {

ec.Subscribe(oSubj, func(subj, reply, s string) {
if s != testString {
t.Fatalf("Got test string of '%s', wanted '%s'\n", s, testString)
t.Fatalf("Received test string of '%s', wanted '%s'\n", s, testString)
}
if subj != oSubj {
t.Fatalf("Got subject of '%s', wanted '%s'\n", subj, oSubj)
t.Fatalf("Received subject of '%s', wanted '%s'\n", subj, oSubj)
}
if reply != oReply {
t.Fatalf("Got reply of '%s', wanted '%s'\n", reply, oReply)
t.Fatalf("Received reply of '%s', wanted '%s'\n", reply, oReply)
}
ch <- true
})
Expand All @@ -260,7 +260,7 @@ func TestEncRequest(t *testing.T) {

err := ec.Request("help", "help me", &resp, 100*time.Millisecond)
if err != nil {
t.Fatalf("Failed receiving proper response: %v\n", err)
t.Fatalf("Failed at receiving proper response: %v\n", err)
}
}

Expand All @@ -276,7 +276,7 @@ func TestEncRequestReceivesMsg(t *testing.T) {

err := ec.Request("help", "help me", &resp, 100*time.Millisecond)
if err != nil {
t.Fatalf("Failed receiving proper response: %v\n", err)
t.Fatalf("Failed at receiving proper response: %v\n", err)
}
}

Expand Down
10 changes: 5 additions & 5 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"
)

// Show different ways to create a Conn
// Shows different ways to create a Conn
func ExampleConnect() {

nats.Connect(nats.DefaultURL)
Expand Down Expand Up @@ -106,7 +106,7 @@ func ExampleConn_FlushTimeout() {
for i := 0; i < 1000; i++ {
nc.PublishMsg(msg)
}
// Only wait up to 1 second for Flush
// Only wait for up to 1 second for Flush
err := nc.FlushTimeout(1 * time.Second)
if err == nil {
// Everything has been processed by the server for nc *Conn.
Expand Down Expand Up @@ -158,7 +158,7 @@ func ExampleConn_Close() {
nc.Close()
}

// Show how to wrap a Conn into an EncodedConn
// Shows how to wrap a Conn into an EncodedConn
func ExampleNewEncodedConn() {
nc, _ := nats.Connect(nats.DefaultURL)
c, _ := nats.NewEncodedConn(nc, "json")
Expand Down Expand Up @@ -186,8 +186,8 @@ func ExampleEncodedConn_Publish() {
// EncodedConn's subscribers will automatically decode the
// wire data into the requested Go type using the Decode()
// method of the registered Encoder. The callback signature
// can also vary to include additional data, like subject and
// reply subjects.
// can also vary to include additional data, such as subject
// and reply subjects.
func ExampleEncodedConn_Subscribe() {
nc, _ := nats.Connect(nats.DefaultURL)
c, _ := nats.NewEncodedConn(nc, "json")
Expand Down
4 changes: 2 additions & 2 deletions json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestJsonMarshalString(t *testing.T) {

ec.Subscribe("json_string", func(s string) {
if s != testString {
t.Fatalf("Got test string of '%s', wanted '%s'\n", s, testString)
t.Fatalf("Received test string of '%s', wanted '%s'\n", s, testString)
}
ch <- true
})
Expand All @@ -43,7 +43,7 @@ func TestJsonMarshalInt(t *testing.T) {

ec.Subscribe("json_int", func(n int) {
if n != testN {
t.Fatalf("Got test int of '%d', wanted '%d'\n", n, testN)
t.Fatalf("Received test int of '%d', wanted '%d'\n", n, testN)
}
ch <- true
})
Expand Down
Loading

0 comments on commit 3741a70

Please sign in to comment.