mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
review fixes
This commit is contained in:
parent
f6eb8fa5a1
commit
3cb9234bb5
5 changed files with 14 additions and 13 deletions
|
|
@ -93,8 +93,8 @@ func (s *Set) Empty() bool {
|
|||
|
||||
const maxPayloadLength = 440
|
||||
|
||||
// String returns all of our enabled capabilities as a string.
|
||||
func (s *Set) String(version Version, values Values) (result []string) {
|
||||
// Strings returns all of our enabled capabilities as a slice of strings.
|
||||
func (s *Set) Strings(version Version, values Values) (result []string) {
|
||||
var strs sort.StringSlice
|
||||
|
||||
var capab Capability
|
||||
|
|
@ -105,7 +105,7 @@ func (s *Set) String(version Version, values Values) (result []string) {
|
|||
continue
|
||||
}
|
||||
capString := capab.Name()
|
||||
if version == Cap302 {
|
||||
if version >= Cap302 {
|
||||
val, exists := values[capab]
|
||||
if exists {
|
||||
capString += "=" + val
|
||||
|
|
|
|||
|
|
@ -43,17 +43,17 @@ func TestSets(t *testing.T) {
|
|||
t.Error("Add/Remove don't work")
|
||||
}
|
||||
|
||||
// test String()
|
||||
// test Strings()
|
||||
values := make(Values)
|
||||
values[InviteNotify] = "invitemepls"
|
||||
|
||||
actualCap301ValuesString := s1.String(Cap301, values)
|
||||
actualCap301ValuesString := s1.Strings(Cap301, values)
|
||||
expectedCap301ValuesString := []string{"invite-notify userhost-in-names"}
|
||||
if !reflect.DeepEqual(actualCap301ValuesString, expectedCap301ValuesString) {
|
||||
t.Errorf("Generated Cap301 values string [%v] did not match expected values string [%v]", actualCap301ValuesString, expectedCap301ValuesString)
|
||||
}
|
||||
|
||||
actualCap302ValuesString := s1.String(Cap302, values)
|
||||
actualCap302ValuesString := s1.Strings(Cap302, values)
|
||||
expectedCap302ValuesString := []string{"invite-notify=invitemepls userhost-in-names"}
|
||||
if !reflect.DeepEqual(actualCap302ValuesString, expectedCap302ValuesString) {
|
||||
t.Errorf("Generated Cap302 values string [%s] did not match expected values string [%s]", actualCap302ValuesString, expectedCap302ValuesString)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue