Loading get.go +12 −4 Original line number Diff line number Diff line Loading @@ -18,16 +18,24 @@ const ( Err ) const ( textChannelIn = "In" textChannelOut = "Out" textChannelErr = "Err" textChannelUndefined = "Undefined" formatChannelUndefined = "unknown channel %d" ) func (c Channel) String() string { switch c { case In: return "In" return textChannelIn case Out: return "Out" return textChannelOut case Err: return "Err" return textChannelErr default: return fmt.Sprintf("unknown channel %d", uint(c)) return fmt.Sprintf(formatChannelUndefined, uint(c)) } } Loading get_test.go +18 −0 Original line number Diff line number Diff line package get import ( "fmt" "testing" "repositories.muehmer.net/bsmrgo/get/mock/passwd" ) func TestChannelStrings(t *testing.T) { uc := 99 for _, c := range []struct { c Channel s string }{ {c: In, s: textChannelIn}, {c: Out, s: textChannelOut}, {c: Err, s: textChannelErr}, {c: Channel(uc), s: fmt.Sprintf(formatChannelUndefined, uc)}, } { if s := c.c.String(); s != c.s { t.Errorf("String() is %q, expected %q", s, c.s) } } } const ( lp1User = "user1" lp1Pass = "pass1" Loading Loading
get.go +12 −4 Original line number Diff line number Diff line Loading @@ -18,16 +18,24 @@ const ( Err ) const ( textChannelIn = "In" textChannelOut = "Out" textChannelErr = "Err" textChannelUndefined = "Undefined" formatChannelUndefined = "unknown channel %d" ) func (c Channel) String() string { switch c { case In: return "In" return textChannelIn case Out: return "Out" return textChannelOut case Err: return "Err" return textChannelErr default: return fmt.Sprintf("unknown channel %d", uint(c)) return fmt.Sprintf(formatChannelUndefined, uint(c)) } } Loading
get_test.go +18 −0 Original line number Diff line number Diff line package get import ( "fmt" "testing" "repositories.muehmer.net/bsmrgo/get/mock/passwd" ) func TestChannelStrings(t *testing.T) { uc := 99 for _, c := range []struct { c Channel s string }{ {c: In, s: textChannelIn}, {c: Out, s: textChannelOut}, {c: Err, s: textChannelErr}, {c: Channel(uc), s: fmt.Sprintf(formatChannelUndefined, uc)}, } { if s := c.c.String(); s != c.s { t.Errorf("String() is %q, expected %q", s, c.s) } } } const ( lp1User = "user1" lp1Pass = "pass1" Loading