-
Notifications
You must be signed in to change notification settings - Fork 7
/
gitmodule_test.go
63 lines (61 loc) · 1.74 KB
/
gitmodule_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package gocodewalker
import (
"reflect"
"testing"
)
func Test_extractGitModuleFolders(t *testing.T) {
type args struct {
input string
}
tests := []struct {
name string
args args
want []string
}{
{
name: "",
args: args{
input: `[submodule "contracts/lib/forge-std"]
path = contracts/lib/forge-std
url = https://github.com/foundry-rs/forge-std
tag = v1.8.2
[submodule "contracts/lib/sp1-contracts"]
path = contracts/lib/sp1-contracts
url = https://github.com/succinctlabs/sp1-contracts
tag = main
[submodule "contracts/lib/openzeppelin-contracts"]
path = contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/java-tron"]
path = lib/java-tron
url = https://github.com/tronprotocol/java-tron
[submodule "lib/googleapis"]
path = lib/googleapis
url = https://github.com/googleapis/googleapis
[submodule "contracts/lib/openzeppelin-contracts-upgradeable"]
path = contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "contracts/lib/v2-testnet-contracts"]
path = contracts/lib/v2-testnet-contracts
url = https://github.com/matter-labs/v2-testnet-contracts
branch = beta`,
},
want: []string{
"contracts/lib/forge-std",
"contracts/lib/sp1-contracts",
"contracts/lib/openzeppelin-contracts",
"lib/java-tron",
"lib/googleapis",
"contracts/lib/openzeppelin-contracts-upgradeable",
"contracts/lib/v2-testnet-contracts",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := extractGitModuleFolders(tt.args.input); !reflect.DeepEqual(got, tt.want) {
t.Errorf("extractGitModuleFolders() = %v, want %v", got, tt.want)
}
})
}
}