Skip to content

Commit

Permalink
Adds ginkgolinter
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola committed Jun 20, 2023
1 parent e2b2d17 commit 30f47d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ linters:
- asciicheck
- bodyclose
- errorlint
- ginkgolinter
- gofmt
- goimports
- importas
Expand Down
6 changes: 3 additions & 3 deletions cmd/dimacs/dimacs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ var _ = Describe("Dimacs", func() {
It("should fail if there is no header", func() {
problem := "1 2 3 0\n"
_, err := dimacs.NewDimacs(bytes.NewReader([]byte(problem)))
Expect(err).ToNot(BeNil())
Expect(err).To(HaveOccurred())
})
It("should fail if there are no clauses", func() {
problem := "p cnf 3 3\n"
_, err := dimacs.NewDimacs(bytes.NewReader([]byte(problem)))
Expect(err).ToNot(BeNil())
Expect(err).To(HaveOccurred())
})
It("should parse valid dimacs", func() {
problem := "p cnf 3 1\n1 2 3 0\n"
d, err := dimacs.NewDimacs(bytes.NewReader([]byte(problem)))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(d.Variables()).To(Equal([]string{"1", "2", "3"}))
Expect(d.Clauses()).To(Equal([]string{"1 2 3"}))
})
Expand Down
12 changes: 6 additions & 6 deletions pkg/deppy/input/entity_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var _ = Describe("EntitySource", func() {
Describe("Get", func() {
It("should return requested entity", func() {
e, err := entitySource.Get(context.Background(), "2-2")
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(e).NotTo(BeNil())
Expect(e.Identifier()).To(Equal(deppy.Identifier("2-2")))
})
Expand All @@ -110,7 +110,7 @@ var _ = Describe("EntitySource", func() {
return fmt.Sprintf("%v", element)
}
el, err := entitySource.Filter(context.Background(), input.Or(byIndex("2"), bySource("1")))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(el).To(MatchAllElements(id, Elements{
"{1-2 map[index:2 source:1]}": Not(BeNil()),
"{2-2 map[index:2 source:2]}": Not(BeNil()),
Expand All @@ -125,7 +125,7 @@ var _ = Describe("EntitySource", func() {
}))

el, err = entitySource.Filter(context.Background(), input.And(byIndex("2"), bySource("1")))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(el).To(MatchAllElements(id, Elements{
"{1-2 map[index:2 source:1]}": Not(BeNil()),
}))
Expand All @@ -136,7 +136,7 @@ var _ = Describe("EntitySource", func() {
}))

el, err = entitySource.Filter(context.Background(), input.And(byIndex("2"), input.Not(bySource("1"))))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(el).To(MatchAllElements(id, Elements{
"{2-2 map[index:2 source:2]}": Not(BeNil()),
}))
Expand All @@ -153,7 +153,7 @@ var _ = Describe("EntitySource", func() {
It("should go through all entities", func() {
entityCheck = map[deppy.Identifier]bool{"1-1": false, "1-2": false, "2-1": false, "2-2": false}
err := entitySource.Iterate(context.Background(), check)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
for _, value := range entityCheck {
Expect(value).To(BeTrue())
}
Expand All @@ -166,7 +166,7 @@ var _ = Describe("EntitySource", func() {
return fmt.Sprintf("%v", element)
}
grouped, err := entitySource.GroupBy(context.Background(), bySourceAndIndex)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(grouped).To(MatchAllKeys(Keys{
"index 1": Not(BeNil()),
"index 2": Not(BeNil()),
Expand Down

0 comments on commit 30f47d6

Please sign in to comment.