(t *testing.T)
| 682 | } |
| 683 | |
| 684 | func TestColumns_FindColumn(t *testing.T) { |
| 685 | cols := Columns{NewColIdent("a"), NewColIdent("c"), NewColIdent("b"), NewColIdent("0")} |
| 686 | |
| 687 | testcases := []struct { |
| 688 | in string |
| 689 | out int |
| 690 | }{{ |
| 691 | in: "a", |
| 692 | out: 0, |
| 693 | }, { |
| 694 | in: "b", |
| 695 | out: 2, |
| 696 | }, |
| 697 | { |
| 698 | in: "0", |
| 699 | out: 3, |
| 700 | }, |
| 701 | { |
| 702 | in: "f", |
| 703 | out: -1, |
| 704 | }} |
| 705 | |
| 706 | for _, tc := range testcases { |
| 707 | val := cols.FindColumn(NewColIdent(tc.in)) |
| 708 | if val != tc.out { |
| 709 | t.Errorf("FindColumn(%s): %d, want %d", tc.in, val, tc.out) |
| 710 | } |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | func TestSplitStatementToPieces(t *testing.T) { |
| 715 | testcases := []struct { |
nothing calls this directly
no test coverage detected