Skip to content

Commit

Permalink
fix: fix path issue for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 6, 2020
1 parent 0170d1e commit 3c7a6db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cmd/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/phodal/coca/core/domain"
"github.com/spf13/cobra"
"log"
"path/filepath"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -93,7 +94,7 @@ var apiCmd = &cobra.Command{

func forceUpdateApi() {
app := new(api.JavaApiApp)
restApis = app.AnalysisPath(apiCmdConfig.Path, parsedDeps, identifiersMap, diMap)
restApis = app.AnalysisPath(filepath.FromSlash(apiCmdConfig.Path), parsedDeps, identifiersMap, diMap)
cModel, _ := json.MarshalIndent(restApis, "", "\t")
cmd_util.WriteToCocaFile("apis.json", string(cModel))
}
Expand Down
8 changes: 3 additions & 5 deletions cmd/api_test.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package cmd

import (
"path/filepath"
"testing"
)

func TestApi(t *testing.T) {
abs, _ := filepath.Abs("../_fixtures/call")
abs = filepath.FromSlash(abs)
path := "../_fixtures/call"

analysis := []cmdTestCase{{
name: "analysis",
cmd: "analysis -p " + abs,
cmd: "analysis -p " + path,
golden: "",
}}
runTestCmd(t, analysis)

tests := []cmdTestCase{{
name: "api",
cmd: "api -c -f -p " + abs,
cmd: "api -c -f -p " + path,
golden: "testdata/api.txt",
}}
runTestCmd(t, tests)
Expand Down

0 comments on commit 3c7a6db

Please sign in to comment.