(t *testing.T)
| 79 | } |
| 80 | |
| 81 | func TestGetModuleDescriptors(t *testing.T) { |
| 82 | descriptorsMu.RLock() |
| 83 | descriptors = map[string]ModuleDescriptor{ |
| 84 | "d": {ID: "d"}, |
| 85 | "c": {ID: "c"}, |
| 86 | "b": {ID: "b"}, |
| 87 | "a": {ID: "a"}, |
| 88 | } |
| 89 | descriptorsMu.RUnlock() |
| 90 | |
| 91 | expect := []ModuleDescriptor{ |
| 92 | {ID: "a"}, |
| 93 | {ID: "b"}, |
| 94 | {ID: "c"}, |
| 95 | {ID: "d"}, |
| 96 | } |
| 97 | |
| 98 | actual := GetModuleDescriptors() |
| 99 | |
| 100 | if !reflect.DeepEqual(actual, expect) { |
| 101 | t.Errorf("expected %v but got %v", expect, actual) |
| 102 | } |
| 103 | |
| 104 | descriptorsMu.RLock() |
| 105 | descriptors = make(map[string]ModuleDescriptor) |
| 106 | descriptorsMu.RUnlock() |
| 107 | } |
nothing calls this directly
no test coverage detected