diff --git a/orm/util_test.go b/orm/util_test.go new file mode 100644 index 00000000..8612a181 --- /dev/null +++ b/orm/util_test.go @@ -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 *\\/ */ "))) + }) +})