forked from exercism/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message 'not in workspace' for MacOS (exercism#968)
* Improve error message 'not in workspace' for MacOS Default installation of MacOS allows user to change directory insensitive of case. This commit wraps a supplemental error message for Mac users, including prints of the workspace and submit path. * go fmt * Update go version in travis.yml Authored-by: Shirley Leu <[email protected]>
- Loading branch information
Shirley Leu
authored
Feb 9, 2021
1 parent
ba48dcd
commit 01cb5bc
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ language: go | |
sudo: false | ||
|
||
go: | ||
- "1.11.x" | ||
- "1.12.x" | ||
- "1.15.x" | ||
- tip | ||
|
||
matrix: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package workspace | ||
|
||
import ( | ||
"fmt" | ||
"github.com/stretchr/testify/assert" | ||
"path/filepath" | ||
"runtime" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestExerciseDir_case_insensitive(t *testing.T) { | ||
_, cwd, _, _ := runtime.Caller(0) | ||
root := filepath.Join(cwd, "..", "..", "fixtures", "solution-dir") | ||
// configuration file was set with "workspace" - the directory that exists | ||
configured := Workspace{Dir: filepath.Join(root, "workspace")} | ||
// user changes into directory with "bad" case - "Workspace" | ||
userPath := strings.Replace(configured.Dir, "workspace", "Workspace", 1) | ||
|
||
_, err := configured.ExerciseDir(filepath.Join(userPath, "exercise", "file.txt")) | ||
|
||
assert.Error(t, err) | ||
assert.Equal(t, fmt.Sprintf("not in workspace: directory location may be case sensitive: "+ | ||
"workspace directory: %s, submit path: %s/exercise/file.txt", configured.Dir, userPath), err.Error()) | ||
} |