mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 10:25:03 +01:00
6a9ae32012
This splits config.go into ui.go for the user interface functions and authorize.go for the implementation of `rclone authorize`. It also moves the tests into the correct places (including one from obscure which was in the wrong place).
30 lines
607 B
Go
30 lines
607 B
Go
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestMatchProvider(t *testing.T) {
|
|
for _, test := range []struct {
|
|
config string
|
|
provider string
|
|
want bool
|
|
}{
|
|
{"", "", true},
|
|
{"one", "one", true},
|
|
{"one,two", "two", true},
|
|
{"one,two,three", "two", true},
|
|
{"one", "on", false},
|
|
{"one,two,three", "tw", false},
|
|
{"!one,two,three", "two", false},
|
|
{"!one,two,three", "four", true},
|
|
} {
|
|
what := fmt.Sprintf("%q,%q", test.config, test.provider)
|
|
got := matchProvider(test.config, test.provider)
|
|
assert.Equal(t, test.want, got, what)
|
|
}
|
|
}
|