Skip to content

Commit

Permalink
Add .gitignore files and refactor semvar
Browse files Browse the repository at this point in the history
  • Loading branch information
Athul Muralidhar committed Sep 25, 2023
1 parent d7a7de9 commit 8371f48
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 33 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ go.work
/.idea/sonarlint/securityhotspotstore/e/a/ea7294d283e3c01f17cfd96a28769ce1bad8cbff
/.idea/sonarlint/securityhotspotstore/index.pb

/protoc
/protoc
/.idea/sonarlint/issuestore/e/3/e3661dc931fae92cdbebb07dae79b6dc0d4b23c7
/.idea/sonarlint/securityhotspotstore/e/3/e3661dc931fae92cdbebb07dae79b6dc0d4b23c7
7 changes: 7 additions & 0 deletions cmd/semvar/sem_var.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ type SemVar struct {
//patch int // FIXME
}

func newSemVar(major, minor int) SemVar {
return SemVar{
Major: major,
Minor: minor,
}
}

func (s SemVar) String() string {
//return "v" + strconv.Itoa(s.major) + "." + strconv.Itoa(s.minor) + "." + strconv.Itoa(s.patch)
return strconv.Itoa(s.Major) + "." + strconv.Itoa(s.Minor)
Expand Down
42 changes: 10 additions & 32 deletions cmd/semvar/semvar_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package semvar_test
package semvar

import (
"testing"
Expand All @@ -12,34 +12,12 @@ func TestSemvar(t *testing.T) {
RunSpecs(t, "Semvar Suite")
}

//func Test_semVar_toProtocURL(t *testing.T) {
// type fields struct {
// major int
// minor int
// }
// tests := []struct {
// name string
// fields fields
// want string
// }{
// {
// name: "happy flow",
// fields: fields{
// major: 24,
// minor: 2,
// },
// want: "https://github.com/protocolbuffers/protobuf/releases/download/v24.2/protoc-24.2-linux-x86_64.zip",
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// s := SemVar{
// Major: tt.fields.major,
// Minor: tt.fields.minor,
// }
// if got := s.ToProtocURL(); got != tt.want {
// t.Errorf("toProtocURL() = %v, want %v", got, tt.want)
// }
// })
// }
//}
var _ = Describe("Semvar", func() {
It("happy flow", func() {
sm := newSemVar(24, 2)

got := sm.ToProtocURL()

Expect(got).To(Equal("https://github.com/protocolbuffers/protobuf/releases/download/v24.2/protoc-24.2-linux-x86_64.zip"))
})
})

0 comments on commit 8371f48

Please sign in to comment.