Skip to content

Commit

Permalink
Refactor simplify TestWorkspaceExercises
Browse files Browse the repository at this point in the history
Reduce needless complexity
  • Loading branch information
jdsutherland committed Aug 31, 2018
1 parent 839a2d4 commit c6bff35
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions workspace/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"path/filepath"
"runtime"
"sort"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -61,12 +60,12 @@ func TestWorkspaceExercises(t *testing.T) {
b2 := filepath.Join(tmpDir, "track-b", "exercise-two")

for _, path := range []string{a1, a2, b1, b2} {
path := filepath.Dir(NewExerciseFromDir(path).MetadataFilepath())
err := os.MkdirAll(path, os.FileMode(0755))
metadataAbsoluteFilepath := filepath.Join(path, metadataFilepath)
err := os.MkdirAll(filepath.Dir(metadataAbsoluteFilepath), os.FileMode(0755))
assert.NoError(t, err)

if !strings.HasPrefix(path, a2) {
err = ioutil.WriteFile(filepath.Join(path, solutionFilename), []byte{}, os.FileMode(0600))
if path != a2 {
err = ioutil.WriteFile(metadataAbsoluteFilepath, []byte{}, os.FileMode(0600))
assert.NoError(t, err)
}
}
Expand Down

0 comments on commit c6bff35

Please sign in to comment.