Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "skip DSL error tests" #308

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 43 additions & 44 deletions dslengine/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,50 +100,49 @@ var _ = Describe("DSL errors", func() {
})
})

// FIXME: @shogo82148
// Context("with invalid DSL", func() {
// // See NOTE below.
// const lineNumber = 111

// BeforeEach(func() {
// API("foo", func() {
// // NOTE: moving the line below requires updating the
// // constant above to match its number.
// Attributes(func() {})
// })
// dslengine.Run()
// })

// It("reports an invalid DSL error", func() {
// Ω(ErrorMsg).Should(ContainSubstring("invalid use of Attributes"))
// Ω(dslengine.Errors).Should(HaveLen(1))
// Ω(dslengine.Errors[0]).ShouldNot(BeNil())
// Ω(dslengine.Errors[0].File).Should(HaveSuffix("runner_test.go"))
// Ω(dslengine.Errors[0].Line).Should(Equal(lineNumber))
// })
// })

// Context("with DSL calling a function with an invalid argument type", func() {
// // See NOTE below.
// const lineNumber = 133

// BeforeEach(func() {
// Type("bar", func() {
// // NOTE: moving the line below requires updating the
// // constant above to match its number.
// Attribute("baz", 42)
// })
// dslengine.Run()
// })

// It("reports an incompatible type DSL error", func() {
// Ω(ErrorMsg).Should(ContainSubstring("cannot use 42 (type int) as type"))
// Ω(dslengine.Errors).Should(HaveLen(1))
// Ω(dslengine.Errors[0]).ShouldNot(BeNil())
// Ω(dslengine.Errors[0].File).Should(HaveSuffix("runner_test.go"))
// Ω(dslengine.Errors[0].Line).Should(Equal(lineNumber))
// })
// })
Context("with invalid DSL", func() {
// See NOTE below.
const lineNumber = 111

BeforeEach(func() {
API("foo", func() {
// NOTE: moving the line below requires updating the
// constant above to match its number.
Attributes(func() {})
})
dslengine.Run()
})

It("reports an invalid DSL error", func() {
Ω(ErrorMsg).Should(ContainSubstring("invalid use of Attributes"))
Ω(dslengine.Errors).Should(HaveLen(1))
Ω(dslengine.Errors[0]).ShouldNot(BeNil())
Ω(dslengine.Errors[0].File).Should(HaveSuffix("runner_test.go"))
Ω(dslengine.Errors[0].Line).Should(Equal(lineNumber))
})
})

Context("with DSL calling a function with an invalid argument type", func() {
// See NOTE below.
const lineNumber = 133

BeforeEach(func() {
Type("bar", func() {
// NOTE: moving the line below requires updating the
// constant above to match its number.
Attribute("baz", 42)
})
dslengine.Run()
})

It("reports an incompatible type DSL error", func() {
Ω(ErrorMsg).Should(ContainSubstring("cannot use 42 (type int) as type"))
Ω(dslengine.Errors).Should(HaveLen(1))
Ω(dslengine.Errors[0]).ShouldNot(BeNil())
Ω(dslengine.Errors[0].File).Should(HaveSuffix("runner_test.go"))
Ω(dslengine.Errors[0].Line).Should(Equal(lineNumber))
})
})

Context("with DSL using an empty type", func() {
BeforeEach(func() {
Expand Down
Loading