MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestIsDateValue

Function TestIsDateValue

coltype_test.go:39–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestIsDateValue(t *testing.T) {
40 tests := []struct {
41 name string
42 input string
43 expected bool
44 }{
45 {"ISO date", "2024-10-17", true},
46 {"ISO datetime", "2024-10-17 15:30:00", true},
47 {"US date", "10/17/2024", true},
48 {"EU date", "17/10/2024", true},
49 {"Alt ISO", "2024/10/17", true},
50 {"RFC3339", "2024-10-17T15:30:00Z", true},
51 {"Month name", "Jan 02, 2024", true},
52 {"Full month", "January 02, 2024", true},
53 {"Dotted", "2024.10.17", true},
54 {"Empty string", "", false},
55 {"Just numbers", "20241017", false},
56 {"Text", "not a date", false},
57 {"Number", "12345", false},
58 }
59
60 for _, tt := range tests {
61 t.Run(tt.name, func(t *testing.T) {
62 result := isDateValue(tt.input)
63 if result != tt.expected {
64 t.Errorf("isDateValue(%q) = %v, want %v", tt.input, result, tt.expected)
65 }
66 })
67 }
68}
69
70func TestAutoDetectColumnType(t *testing.T) {
71 tests := []struct {

Callers

nothing calls this directly

Calls 1

isDateValueFunction · 0.85

Tested by

no test coverage detected