client_test.go 569 B

12345678910111213141516171819202122232425262728
  1. package couchbase
  2. import "testing"
  3. func TestWriteOptionsString(t *testing.T) {
  4. tests := []struct {
  5. opts WriteOptions
  6. exp string
  7. }{
  8. {Raw, "raw"},
  9. {AddOnly, "addonly"},
  10. {Persist, "persist"},
  11. {Indexable, "indexable"},
  12. {Append, "append"},
  13. {AddOnly | Raw, "raw|addonly"},
  14. {0, "0x0"},
  15. {Raw | AddOnly | Persist | Indexable | Append,
  16. "raw|addonly|persist|indexable|append"},
  17. {Raw | 8192, "raw|0x2000"},
  18. }
  19. for _, test := range tests {
  20. got := test.opts.String()
  21. if got != test.exp {
  22. t.Errorf("Expected %v, got %v", test.exp, got)
  23. }
  24. }
  25. }