menu-traversal-refactor #109

Closed
carlos wants to merge 24 commits from menu-traversal-refactor into master
Showing only changes of commit 8791753b2a - Show all commits

View File

@ -13,13 +13,9 @@ type Step struct {
} }
func (s *Step) MatchesExpectedContent(content []byte) (bool, error) { func (s *Step) MatchesExpectedContent(content []byte) (bool, error) {
pattern := `.*\?.*|.*` pattern := regexp.QuoteMeta(s.ExpectedContent)
re, err := regexp.Compile(pattern) re, _ := regexp.Compile(pattern)
if err != nil { if re.Match([]byte(content)) {
return false, err
}
// Check if the content matches the regex pattern
if re.Match(content) {
return true, nil return true, nil
} }
return false, nil return false, nil
@ -38,7 +34,8 @@ type TestCase struct {
} }
carlos marked this conversation as resolved Outdated
Outdated
Review

I prefer typedef instead of inline structs, the latter is hard to read.

should this be an extension of StepTest?

I prefer typedef instead of inline structs, the latter is hard to read. should this be an extension of StepTest?

Created a TestCase struct for generating the test cases: Commit : 810dd74e43.

Created a TestCase struct for generating the test cases: Commit : 810dd74e43936d999d2e6361c6b8a167c67a6317.
func (s *TestCase) MatchesExpectedContent(content []byte) (bool, error) { func (s *TestCase) MatchesExpectedContent(content []byte) (bool, error) {
re, err := regexp.Compile(s.ExpectedContent) pattern := regexp.QuoteMeta(s.ExpectedContent)
re, err := regexp.Compile(pattern)
if err != nil { if err != nil {
return false, err return false, err
} }