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

Configure Feed

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

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 cases := []struct { 24 data string 25 want map[string]*SubmoduleEntry 26 }{{ 27 `[submodule "plugins/abc"] 28 path = plugins/abc 29 url = ../plugins/abc 30 branch = .`, 31 map[string]*SubmoduleEntry{ 32 "plugins/abc": { 33 Path: "plugins/abc", 34 URL: "../plugins/abc", 35 Branch: ".", 36 }, 37 }}, 38 { 39 "\uFEFF" + `[submodule "plugins/abc"] 40 path = plugins/abc 41 url = ../plugins/abc 42 branch = .`, 43 map[string]*SubmoduleEntry{ 44 "plugins/abc": { 45 Path: "plugins/abc", 46 URL: "../plugins/abc", 47 Branch: ".", 48 }, 49 }}, 50 {"", map[string]*SubmoduleEntry{}}, 51 } 52 53 for _, tc := range cases { 54 got, err := ParseGitModules([]byte(tc.data)) 55 if err != nil { 56 t.Fatalf("ParseGitModules: %T", err) 57 } 58 59 if !reflect.DeepEqual(got, tc.want) { 60 t.Fatalf("got %v, want %v", got, tc.want) 61 } 62 } 63}