(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestStringSliceDelta(t *testing.T) { |
| 32 | // Case format: |
| 33 | // - inputs: old, new |
| 34 | // - expected outputs: added, removed, intersection |
| 35 | cases := [][5][]string{ |
| 36 | { |
| 37 | {"abc", "def", "fff"}, {}, |
| 38 | {}, {"abc", "def", "fff"}, {}, |
| 39 | }, |
| 40 | { |
| 41 | {}, {}, {}, {}, {}, |
| 42 | }, |
| 43 | { |
| 44 | {"aa", "xx", "bb", "aa", "bb"}, {"yy", "aa"}, |
| 45 | {"yy"}, {"aa", "bb", "bb", "xx"}, {"aa"}, |
| 46 | }, |
| 47 | { |
| 48 | {"bb", "aa", "bb"}, {"yy", "aa", "bb", "zzz", "zzz", "cc"}, |
| 49 | {"cc", "yy", "zzz", "zzz"}, {"bb"}, {"aa", "bb"}, |
| 50 | }, |
| 51 | { |
| 52 | {"aa", "aa", "aa"}, {"aa", "aa", "aa"}, |
| 53 | {}, {}, {"aa", "aa", "aa"}, |
| 54 | }, |
| 55 | } |
| 56 | |
| 57 | for _, tc := range cases { |
| 58 | added, removed, both := stringSliceDelta( |
| 59 | tc[0], tc[1], |
| 60 | ) |
| 61 | expectSlicesEqual(t, "added", tc[2], added) |
| 62 | expectSlicesEqual(t, "removed", tc[3], removed) |
| 63 | expectSlicesEqual(t, "both", tc[4], both) |
| 64 | |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | func TestParseSearchQuery(t *testing.T) { |
| 69 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…