Fix issue with test ordering for TestParseWords
`TestParseWords` needs to use the `tokenEscape` for one of the test cases, but `tokenEscape` was not being set unless tests ran in a specific order. This sets a default value for `tokenEscape`... `\`... so that tests that rely on this global are not affected by test ordering. This is the simplest fix for these cases. Ideally the token should not be set as a global but rather passed down, which is a much larger change. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Upstream-commit: df167d3ff04cdc90012c8ca39647662ad69e6715 Component: engine
This commit is contained in:
@ -36,19 +36,19 @@ type Node struct {
|
||||
EndLine int // the line in the original dockerfile where the node ends
|
||||
}
|
||||
|
||||
const defaultTokenEscape = "\\"
|
||||
|
||||
var (
|
||||
dispatch map[string]func(string) (*Node, map[string]bool, error)
|
||||
tokenWhitespace = regexp.MustCompile(`[\t\v\f\r ]+`)
|
||||
tokenLineContinuation *regexp.Regexp
|
||||
tokenEscape rune
|
||||
tokenEscape = rune(defaultTokenEscape[0])
|
||||
tokenEscapeCommand = regexp.MustCompile(`^#[ \t]*escape[ \t]*=[ \t]*(?P<escapechar>.).*$`)
|
||||
tokenComment = regexp.MustCompile(`^#.*$`)
|
||||
lookingForDirectives bool
|
||||
directiveEscapeSeen bool
|
||||
)
|
||||
|
||||
const defaultTokenEscape = "\\"
|
||||
|
||||
// setTokenEscape sets the default token for escaping characters in a Dockerfile.
|
||||
func setTokenEscape(s string) error {
|
||||
if s != "`" && s != "\\" {
|
||||
|
||||
Reference in New Issue
Block a user