Add generic set type (#21408)
This PR adds a generic set type to get rid of maps used as sets. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
e84558b093
commit
0e57ff7eee
41 changed files with 328 additions and 324 deletions
|
@ -7,28 +7,23 @@ package public
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestParseAcceptEncoding(t *testing.T) {
|
||||
kases := []struct {
|
||||
Header string
|
||||
Expected map[string]bool
|
||||
Expected container.Set[string]
|
||||
}{
|
||||
{
|
||||
Header: "deflate, gzip;q=1.0, *;q=0.5",
|
||||
Expected: map[string]bool{
|
||||
"deflate": true,
|
||||
"gzip": true,
|
||||
},
|
||||
Header: "deflate, gzip;q=1.0, *;q=0.5",
|
||||
Expected: container.SetOf("deflate", "gzip"),
|
||||
},
|
||||
{
|
||||
Header: " gzip, deflate, br",
|
||||
Expected: map[string]bool{
|
||||
"deflate": true,
|
||||
"gzip": true,
|
||||
"br": true,
|
||||
},
|
||||
Header: " gzip, deflate, br",
|
||||
Expected: container.SetOf("deflate", "gzip", "br"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue