The unit test bubble
Look at the following piece of Go code:
func NewQuery(query []rune) *Query {
q := &Query{
query: &[]rune{},
complete: &[]rune{},
}
_ = q.Set(query)
return q
}
func NewQueryWithString(query string) *Query {
return NewQuery([]rune(query))
}
It is taken from a GitHub project with over 2000 stars.
Now take a look at these unit tests for the same package:
func TestNewQuery(t *testing.T) {
var assert = assert.New(t)
v := []rune(".name")
q := NewQuery(v)
assert.Equal(*q.query, []rune(".name"))
assert.Equal(*q.complete, []rune(""))
}
func TestNewQueryWithString(t *testing.T) {
var assert = assert.New(t)
q := NewQueryWithString(".name")
assert.Equal(*q.query, []rune(".name"))
assert.Equal(*q.complete, []rune(""))
}
Now be honest: what are these for? Is this part of an attack to eat all GitHub storage and head them to bankruptcy?