Skip to content

Commit

Permalink
remove string functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dj Gilcrease committed Oct 3, 2019
1 parent bce80ad commit 230ae50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
22 changes: 0 additions & 22 deletions sense.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ type Relation struct {
Sense rpmSense
}

// String return the string representation of the Relation
func (r *Relation) String() string {
return fmt.Sprintf("%s%v%s", r.Name, r.Sense, r.Version)
}

// Equal compare the equality of two relations
func (r *Relation) Equal(o *Relation) bool {
return r.Name == o.Name && r.Version == o.Version && r.Sense == o.Sense
Expand All @@ -40,23 +35,6 @@ func (r *Relation) Equal(o *Relation) bool {
// Relations is a slice of Relation pointers
type Relations []*Relation

// String return the string representation of the Relations
func (r *Relations) String() string {
var (
val string
total = len(*r)
)

for idx, relation := range *r {
val += fmt.Sprintf("%s%v%s", relation.Name, relation.Sense, relation.Version)
if idx < total-1 {
val += ","
}
}

return val
}

// Set parse a string into a Relation and append it to the Relations slice if it is missing
// this is used by the flag package
func (r *Relations) Set(value string) error {
Expand Down
3 changes: 2 additions & 1 deletion sense_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package rpmpack

import (
"fmt"
"testing"
)

Expand Down Expand Up @@ -72,7 +73,7 @@ func TestNewRelation(t *testing.T) {
return
}

val := relation.String()
val := fmt.Sprintf("%s%v%s", relation.Name, relation.Sense, relation.Version)
if !testCase.errExpected && val != testCase.output {
tt.Errorf("%s should have returned %s not %s", testCase.input, testCase.output, val)
}
Expand Down

0 comments on commit 230ae50

Please sign in to comment.