2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2022-03-19 21:29:32 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-10-27 14:02:58 +00:00
|
|
|
"github.com/shoenig/test/must"
|
2022-03-19 21:29:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test_isCoveredOne(t *testing.T) {
|
|
|
|
try := func(p string, exp bool) {
|
|
|
|
result := isCoveredOne(p, "foo/bar")
|
2022-10-27 14:02:58 +00:00
|
|
|
must.Eq(t, exp, result)
|
2022-03-19 21:29:32 +00:00
|
|
|
}
|
|
|
|
try("baz", false)
|
|
|
|
try("foo", false)
|
|
|
|
try("foo/bar/baz", false)
|
|
|
|
try("foo/bar", true)
|
|
|
|
try("foo/bar/...", true)
|
|
|
|
try("foo/...", true)
|
|
|
|
try("abc/...", false)
|
|
|
|
}
|