blob: ca7fef3e3c6860faca129124db914a6f5829c906 [file] [log] [blame]
// Copyright 2016 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package gitindex
import (
"reflect"
"testing"
)
func TestParseGitModules(t *testing.T) {
testData := `[submodule "plugins/abc"]
path = plugins/abc
url = ../plugins/abc
branch = .`
got, err := ParseGitModules([]byte(testData))
if err != nil {
t.Fatalf("ParseGitModules: %T", err)
}
want := map[string]*SubmoduleEntry{
"plugins/abc": {
Path: "plugins/abc",
URL: "../plugins/abc",
Branch: ".",
},
}
if !reflect.DeepEqual(got, want) {
t.Fatalf("got %v, want %v", got, want)
}
}