Skip to content

Instantly share code, notes, and snippets.

@chaoticryptidz
Created December 18, 2019 11:10
Show Gist options
  • Save chaoticryptidz/4df9aff07cbbd9f8c0bbd216cc15959d to your computer and use it in GitHub Desktop.
Save chaoticryptidz/4df9aff07cbbd9f8c0bbd216cc15959d to your computer and use it in GitHub Desktop.
var doesMatchTagsTests = []struct {
searchTags []string
post Post
result bool
}{
{
[]string{"potato"},
Post{
Tags: []string{"tomato"},
},
false,
},
{
[]string{"-potato"},
Post{
Tags: []string{"potato"},
},
false,
},
{
[]string{"potato"},
Post{
Tags: []string{"potato"},
},
true,
},
{
[]string{"*"},
Post{
Tags: []string{"potato"},
},
true,
},
{
[]string{"-*"},
Post{
Tags: []string{"potato"},
},
false,
},
{
[]string{""},
Post{
Tags: []string{"potato"},
},
false,
},
{
[]string{"tomato"},
Post{
Tags: []string{"potato", "tomato"},
},
true,
},
{
[]string{"tomato"},
Post{
Tags: []string{"tomato", "potato"},
},
true,
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment