-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote_test.go
30 lines (27 loc) · 1.08 KB
/
remote_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
package main
import (
"reflect"
"testing"
)
func TestParseRemotePackageConf(t *testing.T) {
str := "lotem/rime-forge@master/lotem-packages.conf"
result := []string{"lotem/rime-aoyu", "lotem/rime-bopomofo-script", "lotem/rime-dungfungpuo", "lotem/rime-guhuwubi", "lotem/rime-ipa", "lotem/rime-linguistic-wubi", "lotem/rime-kana", "lotem/rime-wubi98", "lotem/rime-zhengma", "lotem/rime-zhung"}
strs, err := ParseRemotePackageConf(str)
if !reflect.DeepEqual(strs, result) {
t.Errorf("ParseRemotePackageConf failed, expected %v, got %v", result, strs)
}
if err != nil {
t.Errorf("ParseRemotePackageConf failed, expected nil error, got %s", err)
}
}
func TestValidateRemotePackageConf(t *testing.T) {
str := "lotem/rime-forge@master/lotem-packages.conf"
result := "https://github.com/lotem/rime-forge/raw/master/lotem-packages.conf"
str1, err := validateRemotePackageConf(str)
if str1 != result {
t.Errorf("ValidateRemovePackageConf failed, expect result %s, got %s", result, str1)
}
if err != nil {
t.Errorf("ValidateRemotePackageConf failed, expect nil error, got %s", err)
}
}