Add ability to parse local dependency

This commit is contained in:
Matthias Loibl 2019-07-22 19:42:43 +02:00
parent e5199342ea
commit 6ee790d911
No known key found for this signature in database
GPG key ID: 78A796CA74CA38BA
2 changed files with 86 additions and 23 deletions

View file

@ -15,6 +15,7 @@
package main
import (
"os"
"testing"
"github.com/jsonnet-bundler/jsonnet-bundler/spec"
@ -22,6 +23,13 @@ import (
)
func TestParseDepedency(t *testing.T) {
const testFolder = "test/jsonnet/foobar"
err := os.MkdirAll(testFolder, os.ModePerm)
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll("test")
tests := []struct {
name string
path string
@ -65,6 +73,20 @@ func TestParseDepedency(t *testing.T) {
Version: "master",
},
},
{
name: "local",
path: testFolder,
want: &spec.Dependency{
Name: "foobar",
Source: spec.Source{
GitSource: &spec.GitSource{
Remote: ".",
Subdir: "test/jsonnet/foobar",
},
},
Version: ".",
},
},
}
for _, tt := range tests {
_ = t.Run(tt.name, func(t *testing.T) {