fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 1.6 kB View raw
1// Copyright 2016 Google Inc. All rights reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package gitindex 16 17import ( 18 "reflect" 19 "testing" 20) 21 22func TestParseGitModules(t *testing.T) { 23 t.Parallel() 24 25 cases := []struct { 26 data string 27 want map[string]*SubmoduleEntry 28 }{ 29 { 30 `[submodule "plugins/abc"] 31 path = plugins/abc 32 url = ../plugins/abc 33 branch = .`, 34 map[string]*SubmoduleEntry{ 35 "plugins/abc": { 36 Path: "plugins/abc", 37 URL: "../plugins/abc", 38 Branch: ".", 39 }, 40 }, 41 }, 42 { 43 "\uFEFF" + `[submodule "plugins/abc"] 44 path = plugins/abc 45 url = ../plugins/abc 46 branch = .`, 47 map[string]*SubmoduleEntry{ 48 "plugins/abc": { 49 Path: "plugins/abc", 50 URL: "../plugins/abc", 51 Branch: ".", 52 }, 53 }, 54 }, 55 {"", map[string]*SubmoduleEntry{}}, 56 } 57 58 for _, tc := range cases { 59 got, err := ParseGitModules([]byte(tc.data)) 60 if err != nil { 61 t.Fatalf("ParseGitModules: %T", err) 62 } 63 64 if !reflect.DeepEqual(got, tc.want) { 65 t.Fatalf("got %v, want %v", got, tc.want) 66 } 67 } 68}