(t *testing.T)
| 439 | } |
| 440 | |
| 441 | func TestLeftJoinUp(t *testing.T) { |
| 442 | // Defined at level 0 |
| 443 | iter1 := &testIterator{rows: []IteratorResult{ |
| 444 | testResult("x", "A", 1), |
| 445 | testResult("x", "B", 2), |
| 446 | }} |
| 447 | |
| 448 | // Defined at level 1 |
| 449 | iter2 := &testIterator{rows: []IteratorResult{ |
| 450 | testResult("y", "A", 1, 0), |
| 451 | testResult("y", "B", 1, 1), |
| 452 | testResult("y", "C", 2, 0), |
| 453 | }} |
| 454 | |
| 455 | expected := []IteratorResult{ |
| 456 | { |
| 457 | RowNumber: rn(1), |
| 458 | OtherEntries: []struct { |
| 459 | Key string |
| 460 | Value interface{} |
| 461 | }{ |
| 462 | {Key: "x", Value: "A"}, |
| 463 | {Key: "y", Value: "A"}, |
| 464 | {Key: "y", Value: "B"}, |
| 465 | }, |
| 466 | }, |
| 467 | { |
| 468 | RowNumber: rn(2), |
| 469 | OtherEntries: []struct { |
| 470 | Key string |
| 471 | Value interface{} |
| 472 | }{ |
| 473 | {Key: "x", Value: "B"}, |
| 474 | {Key: "y", Value: "C"}, |
| 475 | }, |
| 476 | }, |
| 477 | } |
| 478 | |
| 479 | got := []IteratorResult{} |
| 480 | |
| 481 | j, err := NewLeftJoinIterator(0, []Iterator{iter1, iter2}, nil, nil) |
| 482 | require.NoError(t, err) |
| 483 | |
| 484 | for { |
| 485 | res, err := j.Next() |
| 486 | require.NoError(t, err) |
| 487 | if res == nil { |
| 488 | break |
| 489 | } |
| 490 | got = append(got, clone(res)) |
| 491 | } |
| 492 | |
| 493 | require.Equal(t, expected, got) |
| 494 | } |
| 495 | |
| 496 | func TestLeftJoinDown(t *testing.T) { |
| 497 | iter1DefLevel := 2 |
nothing calls this directly
no test coverage detected