Skip to content

Commit 75e9f3f

Browse files
committed
gofmt internal/exercises/exercises_test.go
1 parent 73e9450 commit 75e9f3f

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

internal/exercises/exercises_test.go

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package exercises
22

33
import (
4-
"sync"
54
"strings"
5+
"sync"
66
"testing"
77
"testing/fstest"
88

@@ -15,7 +15,6 @@ func y(v any) []byte {
1515
return b
1616
}
1717

18-
//
1918
func TestLoadExercisesDir_LoadsValidYAML(t *testing.T) {
2019
fsys := fstest.MapFS{
2120
"Catalog/Concepts/a.yaml": &fstest.MapFile{
@@ -55,7 +54,6 @@ func TestLoadExercisesDir_LoadsValidYAML(t *testing.T) {
5554
}
5655
}
5756

58-
5957
func TestLoadExercisesDir_RejectsEmptySlug(t *testing.T) {
6058
fsys := fstest.MapFS{
6159
"Catalog/Concepts/bad.yaml": &fstest.MapFile{
@@ -84,7 +82,6 @@ func TestLoadExercisesDir_IgnoresNonYAML(t *testing.T) {
8482
}
8583
}
8684

87-
8885
func TestLoadCatalogFromFS_LoadsConceptsAndProjects(t *testing.T) {
8986
fsys := fstest.MapFS{
9087
"Catalog/Concepts/a.yaml": &fstest.MapFile{
@@ -148,7 +145,6 @@ func TestLoadCatalogFromFS_InvalidYAML(t *testing.T) {
148145
}
149146
}
150147

151-
152148
func TestFallbackCatalog(t *testing.T) {
153149
f := fallbackCatalog()
154150
if len(f.Concepts) != 1 {
@@ -159,29 +155,26 @@ func TestFallbackCatalog(t *testing.T) {
159155
}
160156
}
161157

162-
163158
func TestCatalog_UsesDirectoryLoader(t *testing.T) {
164-
// Reset catalogOnce
165-
catalogOnce = sync.Once{}
166-
167-
fsys := fstest.MapFS{
168-
"Catalog/Concepts/a.yaml": &fstest.MapFile{
169-
Data: y(Exercise{Slug: "01_test"}),
170-
},
171-
}
172-
173-
// Call loader directly
174-
cat, err := loadCatalogFromFS(fsys)
175-
if err != nil {
176-
t.Fatalf("unexpected error: %v", err)
177-
}
178-
179-
if len(cat.Concepts) != 1 || cat.Concepts[0].Slug != "01_test" {
180-
t.Fatalf("loadCatalogFromFS did not correctly read from FS")
181-
}
182-
}
159+
// Reset catalogOnce
160+
catalogOnce = sync.Once{}
161+
162+
fsys := fstest.MapFS{
163+
"Catalog/Concepts/a.yaml": &fstest.MapFile{
164+
Data: y(Exercise{Slug: "01_test"}),
165+
},
166+
}
183167

168+
// Call loader directly
169+
cat, err := loadCatalogFromFS(fsys)
170+
if err != nil {
171+
t.Fatalf("unexpected error: %v", err)
172+
}
184173

174+
if len(cat.Concepts) != 1 || cat.Concepts[0].Slug != "01_test" {
175+
t.Fatalf("loadCatalogFromFS did not correctly read from FS")
176+
}
177+
}
185178

186179
func TestDiscoverLocal_NoDir(t *testing.T) {
187180
_, err := discoverLocal()

0 commit comments

Comments
 (0)