You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
858 B
39 lines
858 B
package formattools
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func TestCompactMatch(t *testing.T) {
|
|
table := []struct {
|
|
O string
|
|
I []string
|
|
}{
|
|
{
|
|
"nanoleaf:172.16.119.33:{abcd,dead,beef,0000}",
|
|
[]string{
|
|
"nanoleaf:172.16.119.33:abcd", "nanoleaf:172.16.119.33:dead",
|
|
"nanoleaf:172.16.119.33:beef", "nanoleaf:172.16.119.33:0000",
|
|
},
|
|
},
|
|
{
|
|
"nanoleaf:172.16.{119.33:abcd,22.33:dead}",
|
|
[]string{
|
|
"nanoleaf:172.16.119.33:abcd", "nanoleaf:172.16.22.33:dead",
|
|
},
|
|
},
|
|
{
|
|
"{nanoleaf:172.16.119.33:abcd,hue:172.16.119.34:81bd3cc3-cf22-4401-a5cb-a4bf18687270}",
|
|
[]string{
|
|
"nanoleaf:172.16.119.33:abcd", "hue:172.16.119.34:81bd3cc3-cf22-4401-a5cb-a4bf18687270",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, row := range table {
|
|
t.Run(row.O, func(t *testing.T) {
|
|
assert.Equal(t, row.O, CompactMatch(row.I))
|
|
})
|
|
}
|
|
}
|