Skip to content

Commit

Permalink
Implemented tests for appendComment to verify proper escaping of comm…
Browse files Browse the repository at this point in the history
…ent symbols
  • Loading branch information
wwoytenko committed Sep 30, 2024
1 parent f748967 commit 1b9e595
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions orm/util_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package orm

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe("Comment - escape comment symbols", func() {
It("only open sequence", func() {
var res []byte
c := "/* comment"

s := appendComment(res, c)
Expect(s).To(Equal([]byte("/* /\\* comment */ ")))
})
It("only close sequence", func() {
var res []byte
c := "comment */"

s := appendComment(res, c)
Expect(s).To(Equal([]byte("/* comment *\\/ */ ")))
})
It("open and close sequences", func() {
var res []byte
c := "/* comment */"

s := appendComment(res, c)
Expect(s).To(Equal([]byte("/* /\\* comment *\\/ */ ")))
})
})

0 comments on commit 1b9e595

Please sign in to comment.