Skip to content

Commit efb43e0

Browse files
committed
style: format test files with go fmt
1 parent 024b39c commit efb43e0

3 files changed

Lines changed: 28 additions & 28 deletions

File tree

cmd/cimis/main_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ func TestParseCacheSize(t *testing.T) {
1212
// Gigabytes
1313
{"1GB", 1 * 1024 * 1024 * 1024},
1414
{"1.5GB", int64(1.5 * 1024 * 1024 * 1024)},
15-
{"2gb", 2 * 1024 * 1024 * 1024}, // case insensitive
16-
{" 1GB ", 1 * 1024 * 1024 * 1024}, // whitespace
15+
{"2gb", 2 * 1024 * 1024 * 1024}, // case insensitive
16+
{" 1GB ", 1 * 1024 * 1024 * 1024}, // whitespace
1717

1818
// Megabytes
1919
{"100MB", 100 * 1024 * 1024},
@@ -31,8 +31,8 @@ func TestParseCacheSize(t *testing.T) {
3131
// Invalid
3232
{"", 0},
3333
{"abc", 0},
34-
{"MB", 0}, // no number
35-
{"10XB", 0}, // unknown suffix
34+
{"MB", 0}, // no number
35+
{"10XB", 0}, // unknown suffix
3636
{"-1MB", -1 * 1024 * 1024}, // negative values pass through ParseFloat
3737
}
3838

@@ -79,9 +79,9 @@ func TestParseStationList(t *testing.T) {
7979

8080
// Errors
8181
{"abc", nil, true},
82-
{"1-2-3", nil, true}, // invalid range
83-
{"1-abc", nil, true}, // invalid range end
84-
{"abc-5", nil, true}, // invalid range start
82+
{"1-2-3", nil, true}, // invalid range
83+
{"1-abc", nil, true}, // invalid range end
84+
{"abc-5", nil, true}, // invalid range start
8585
}
8686

8787
for _, tt := range tests {

cmd/cimis/metrics_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ func TestAllocMetricsString(t *testing.T) {
2525

2626
func TestClassifyRetryableError(t *testing.T) {
2727
tests := []struct {
28-
name string
29-
err error
30-
statusCode int
31-
wantRetry bool
32-
wantNil bool
28+
name string
29+
err error
30+
statusCode int
31+
wantRetry bool
32+
wantNil bool
3333
}{
3434
{"nil error", nil, 0, false, true},
3535

internal/api/client_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,23 @@ func TestHasQCFlag(t *testing.T) {
120120

121121
func TestParseDateYYYYMMDD(t *testing.T) {
122122
tests := []struct {
123-
input string
123+
input string
124124
wantYear, wantMonth, wantDay int
125-
wantOK bool
125+
wantOK bool
126126
}{
127127
{"2024-01-15", 2024, 1, 15, true},
128128
{"1985-01-01", 1985, 1, 1, true},
129129
{"2099-12-31", 2099, 12, 31, true},
130130
{"", 0, 0, 0, false},
131131
{"short", 0, 0, 0, false},
132-
{"2024/01/15", 0, 0, 0, false}, // wrong separator
133-
{"20240115xx", 0, 0, 0, false}, // wrong length ok but wrong format
134-
{"1984-01-01", 0, 0, 0, false}, // before epoch
135-
{"2101-01-01", 0, 0, 0, false}, // after 2100
136-
{"2024-13-01", 0, 0, 0, false}, // invalid month
137-
{"2024-00-01", 0, 0, 0, false}, // month 0
138-
{"2024-01-00", 0, 0, 0, false}, // day 0
139-
{"2024-01-32", 0, 0, 0, false}, // day 32
132+
{"2024/01/15", 0, 0, 0, false}, // wrong separator
133+
{"20240115xx", 0, 0, 0, false}, // wrong length ok but wrong format
134+
{"1984-01-01", 0, 0, 0, false}, // before epoch
135+
{"2101-01-01", 0, 0, 0, false}, // after 2100
136+
{"2024-13-01", 0, 0, 0, false}, // invalid month
137+
{"2024-00-01", 0, 0, 0, false}, // month 0
138+
{"2024-01-00", 0, 0, 0, false}, // day 0
139+
{"2024-01-32", 0, 0, 0, false}, // day 32
140140
}
141141

142142
for _, tt := range tests {
@@ -183,9 +183,9 @@ func TestDaysSinceEpoch(t *testing.T) {
183183
func TestConvertDailyToRecords(t *testing.T) {
184184
apiRecords := []*DailyDataRecord{
185185
{
186-
Date: "2024-06-15",
187-
DayAirTmpAvg: &MeasurementValue{Value: "25.3", Qc: " "},
188-
DayAsceEto: &MeasurementValue{Value: "5.2", Qc: " "},
186+
Date: "2024-06-15",
187+
DayAirTmpAvg: &MeasurementValue{Value: "25.3", Qc: " "},
188+
DayAsceEto: &MeasurementValue{Value: "5.2", Qc: " "},
189189
DayWindSpdAvg: &MeasurementValue{Value: "3.1", Qc: " "},
190190
DayRelHumAvg: &MeasurementValue{Value: "65", Qc: " "},
191191
DaySolRadAvg: &MeasurementValue{Value: "2.5", Qc: " "},
@@ -478,9 +478,9 @@ func TestFetchHourlyDataHTTP(t *testing.T) {
478478
func TestConvertMinimalDailyToRecords(t *testing.T) {
479479
minRecords := []MinimalDailyRecord{
480480
{
481-
Date: "2024-06-15",
482-
DayAirTmpAvg: &MinimalMeasurementValue{Value: 25.3, Qc: " "},
483-
DayAsceEto: &MinimalMeasurementValue{Value: 5.2, Qc: " "},
481+
Date: "2024-06-15",
482+
DayAirTmpAvg: &MinimalMeasurementValue{Value: 25.3, Qc: " "},
483+
DayAsceEto: &MinimalMeasurementValue{Value: 5.2, Qc: " "},
484484
DayWindSpdAvg: &MinimalMeasurementValue{Value: 3.1, Qc: " "},
485485
DayRelHumAvg: &MinimalMeasurementValue{Value: 65.0, Qc: " "},
486486
DaySolRadAvg: &MinimalMeasurementValue{Value: 2.5, Qc: " "},

0 commit comments

Comments
 (0)