builder/parser: fix handling of empty strings as the only argument.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
This commit is contained in:
Erik Hollensbe 2014-08-29 13:04:34 -07:00
parent 234f0e4f79
commit 6b322ad2d3
3 changed files with 9 additions and 4 deletions

View File

@ -81,8 +81,10 @@ func parseLine(line string) (string, *Node, error) {
return "", nil, err
}
node.Next = sexp
node.Attributes = attrs
if sexp.Value != "" || sexp.Next != nil || sexp.Children != nil {
node.Next = sexp
node.Attributes = attrs
}
return "", node, nil
}

View File

@ -1,6 +1,7 @@
package parser
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -69,7 +70,9 @@ func TestTestData(t *testing.T) {
t.Fatalf("Error reading %s's result file: %s", dir.Name(), err.Error())
}
if ast.Dump() != string(content) {
if ast.Dump()+"\n" != string(content) {
fmt.Fprintln(os.Stderr, ast.Dump())
fmt.Fprintln(os.Stderr, string(content))
t.Fatalf("%s: AST dump of dockerfile does not match result", dir.Name())
}

View File

@ -1,5 +1,5 @@
(from "brimstone/ubuntu:14.04")
(cmd "")
(cmd)
(entrypoint "/usr/bin/consul" "agent" "-server" "-data-dir=/consul" "-client=0.0.0.0" "-ui-dir=/webui")
(expose "8500" "8600" "8400" "8301" "8302")
(run "apt-get update && apt-get install -y unzip wget && apt-get clean && rm -rf /var/lib/apt/lists")