MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestSetString

Function TestSetString

channels/set_test.go:356–418  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

354}
355
356func TestSetString(t *testing.T) {
357 testCases := []struct {
358 name string
359 input Set
360 output string
361 redactedOutput []string
362 }{
363 {
364 name: "empty,emptyID",
365 input: Set{},
366 output: "{}",
367 redactedOutput: []string{"{}"},
368 },
369 {
370 name: "two collections",
371 input: Set{
372 NewID("A", 1): present{},
373 NewID("B", 2): present{},
374 NewID("C", 1): present{},
375 },
376 output: "{A, B, C}",
377 redactedOutput: []string{
378 "{<ud>A</ud>, <ud>C</ud>, <ud>B</ud>}",
379 "{<ud>A</ud>, <ud>B</ud>, <ud>C</ud>}",
380 "{<ud>C</ud>, <ud>A</ud>, <ud>B</ud>}",
381 "{<ud>C</ud>, <ud>B</ud>, <ud>A</ud>}",
382 "{<ud>B</ud>, <ud>A</ud>, <ud>C</ud>}",
383 "{<ud>B</ud>, <ud>C</ud>, <ud>A</ud>}",
384 },
385 },
386 {
387 name: "two collections, collection2",
388 input: Set{
389 NewID("A", 2): present{},
390 NewID("B", 2): present{},
391 NewID("C", 1): present{},
392 },
393 output: "{A, B, C}",
394 redactedOutput: []string{
395 "{<ud>A</ud>, <ud>C</ud>, <ud>B</ud>}",
396 "{<ud>A</ud>, <ud>B</ud>, <ud>C</ud>}",
397 "{<ud>C</ud>, <ud>A</ud>, <ud>B</ud>}",
398 "{<ud>C</ud>, <ud>B</ud>, <ud>A</ud>}",
399 "{<ud>B</ud>, <ud>A</ud>, <ud>C</ud>}",
400 "{<ud>B</ud>, <ud>C</ud>, <ud>A</ud>}",
401 },
402 },
403 {
404 name: "one collection",
405 input: Set{
406 NewID("A", 1): present{},
407 },
408 output: "{A}",
409 redactedOutput: []string{"{<ud>A</ud>}"},
410 },
411 }
412 for _, test := range testCases {
413 t.Run(test.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

UDFunction · 0.92
NewIDFunction · 0.85
RunMethod · 0.65
StringMethod · 0.65
ContainsMethod · 0.65
RedactMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected