Skip to content

Commit

Permalink
simplify by always using all message lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Mornini committed Jun 2, 2017
1 parent 26421a6 commit a81c617
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion 05-expected-response-match-parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func expectedResponseMatchParser(context *context) {

expectedResponse := context.SpecTriplet.ExpectedResponse

for _, line := range expectedResponse.allHeaderAndBodyLines() {
for _, line := range expectedResponse.allLines() {
parts := strings.Split(line.Text, regexpIdentifier)

count := len(parts)
Expand Down
4 changes: 2 additions & 2 deletions 09-comparitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ func responseComparitor(context *context) {
expectedResponse := context.SpecTriplet.ExpectedResponse
actualResponse := context.SpecTriplet.ActualResponse

expectedResponseLines := expectedResponse.allHeaderAndBodyLines()
actualResponseLines := actualResponse.allHeaderAndBodyLines()
expectedResponseLines := expectedResponse.allLines()
actualResponseLines := actualResponse.allLines()

if len(actualResponseLines) != len(expectedResponseLines) {
errorHandler(
Expand Down
10 changes: 1 addition & 9 deletions type-message.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,12 @@ func (message *message) allLines() []*line {

allLines = append(allLines, message.FirstLine)
allLines = append(allLines, message.HeaderLines...)
allLines = append(allLines, message.BlankLine)
allLines = append(allLines, message.BodyLines...)

return allLines
}

func (message *message) allHeaderAndBodyLines() []*line {
var allHeaderAndBodyLines []*line

allHeaderAndBodyLines = append(allHeaderAndBodyLines, message.HeaderLines...)
allHeaderAndBodyLines = append(allHeaderAndBodyLines, message.BodyLines...)

return allHeaderAndBodyLines
}

func (message *message) substitute(context *context) {
for _, line := range message.allLines() {
line.substitute(context)
Expand Down

0 comments on commit a81c617

Please sign in to comment.