(t *testing.T)
| 340 | } |
| 341 | |
| 342 | func TestFunctionMap(t *testing.T) { |
| 343 | |
| 344 | fm := make(functionMap) |
| 345 | nodes := []graph.NodeInfo{ |
| 346 | {Name: "fun1"}, |
| 347 | {Name: "fun2", File: "filename"}, |
| 348 | {Name: "fun1"}, |
| 349 | {Name: "fun2", File: "filename2"}, |
| 350 | } |
| 351 | |
| 352 | want := []struct { |
| 353 | wantFunction profile.Function |
| 354 | wantAdded bool |
| 355 | }{ |
| 356 | {profile.Function{ID: 1, Name: "fun1"}, true}, |
| 357 | {profile.Function{ID: 2, Name: "fun2", Filename: "filename"}, true}, |
| 358 | {profile.Function{ID: 1, Name: "fun1"}, false}, |
| 359 | {profile.Function{ID: 3, Name: "fun2", Filename: "filename2"}, true}, |
| 360 | } |
| 361 | |
| 362 | for i, tc := range nodes { |
| 363 | gotFunc, gotAdded := fm.findOrAdd(tc) |
| 364 | if got, want := gotFunc, want[i].wantFunction; *got != want { |
| 365 | t.Errorf("%d: got %v, want %v", i, got, want) |
| 366 | } |
| 367 | if got, want := gotAdded, want[i].wantAdded; got != want { |
| 368 | t.Errorf("%d: got %v, want %v", i, got, want) |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | func TestLegendActiveFilters(t *testing.T) { |
| 374 | activeFilterInput := []string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…