|
| 1 | +package schema |
| 2 | + |
| 3 | +import "testing" |
| 4 | + |
| 5 | +func TestTestSourceColumns_Default(t *testing.T) { |
| 6 | + // basic sanity check for tested columns |
| 7 | + defaults := TestSourceColumns() |
| 8 | + if len(defaults) < 100 { |
| 9 | + t.Fatal("expected at least 100 columns by default") |
| 10 | + } |
| 11 | + // test some specific columns |
| 12 | + checkColumnsExist(t, defaults, []string{"int64", "date32", "timestamp_us", "string", "struct", "string_map", "string_list"}) |
| 13 | +} |
| 14 | + |
| 15 | +func TestTestSourceColumns_SkipAll(t *testing.T) { |
| 16 | + skipAll := ColumnList(TestSourceColumns( |
| 17 | + WithTestSourceSkipStructs(), |
| 18 | + WithTestSourceSkipMaps(), |
| 19 | + WithTestSourceSkipDates(), |
| 20 | + WithTestSourceSkipTimes(), |
| 21 | + WithTestSourceSkipTimestamps(), |
| 22 | + WithTestSourceSkipDurations(), |
| 23 | + WithTestSourceSkipIntervals(), |
| 24 | + WithTestSourceSkipLargeTypes(), |
| 25 | + )) |
| 26 | + // test some specific columns |
| 27 | + checkColumnsExist(t, skipAll, []string{"int64", "timestamp_us", "string", "string_list"}) |
| 28 | + checkColumnsDontExist(t, skipAll, []string{"date32", "struct", "string_map"}) |
| 29 | +} |
| 30 | + |
| 31 | +func checkColumnsExist(t *testing.T, list ColumnList, cols []string) { |
| 32 | + for _, col := range cols { |
| 33 | + if list.Get(col) == nil { |
| 34 | + t.Errorf("expected column %s to be present", col) |
| 35 | + } |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +func checkColumnsDontExist(t *testing.T, list ColumnList, cols []string) { |
| 40 | + for _, col := range cols { |
| 41 | + if list.Get(col) != nil { |
| 42 | + t.Errorf("expected no %s column", col) |
| 43 | + } |
| 44 | + } |
| 45 | +} |
0 commit comments