This will test that comma separated url strings work properly for the Connect() command.
(t *testing.T)
| 425 | // This will test that comma separated url strings work properly for |
| 426 | // the Connect() command. |
| 427 | func TestUrlArgument(t *testing.T) { |
| 428 | check := func(url string, expected []string) { |
| 429 | if !reflect.DeepEqual(processUrlString(url), expected) { |
| 430 | t.Fatalf("Got wrong response processing URL: %q, RES: %#v\n", url, processUrlString(url)) |
| 431 | } |
| 432 | } |
| 433 | // This is normal case |
| 434 | oneExpected := []string{"nats://localhost:1222"} |
| 435 | |
| 436 | check("nats://localhost:1222", oneExpected) |
| 437 | check("nats://localhost:1222 ", oneExpected) |
| 438 | check(" nats://localhost:1222", oneExpected) |
| 439 | check(" nats://localhost:1222 ", oneExpected) |
| 440 | check("nats://localhost:1222/", oneExpected) |
| 441 | |
| 442 | var multiExpected = []string{ |
| 443 | "nats://localhost:1222", |
| 444 | "nats://localhost:1223", |
| 445 | "nats://localhost:1224", |
| 446 | } |
| 447 | |
| 448 | check("nats://localhost:1222,nats://localhost:1223,nats://localhost:1224", multiExpected) |
| 449 | check("nats://localhost:1222, nats://localhost:1223, nats://localhost:1224", multiExpected) |
| 450 | check(" nats://localhost:1222, nats://localhost:1223, nats://localhost:1224 ", multiExpected) |
| 451 | check("nats://localhost:1222, nats://localhost:1223 ,nats://localhost:1224", multiExpected) |
| 452 | check("nats://localhost:1222/,nats://localhost:1223/,nats://localhost:1224/", multiExpected) |
| 453 | } |
| 454 | |
| 455 | func TestParserPing(t *testing.T) { |
| 456 | c := &Conn{} |
nothing calls this directly
no test coverage detected