test explicit input over stdin and generate option defaults
This commit is contained in:
parent
736741915c
commit
fd0e62377a
@ -188,6 +188,14 @@ var checkTests = []mainTest{
|
|||||||
"treerack", "check", "-syntax-string", `foo = "bar"`, "-input-string", "bar",
|
"treerack", "check", "-syntax-string", `foo = "bar"`, "-input-string", "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "explicit over stdin",
|
||||||
|
args: []string{
|
||||||
|
"treerack", "check", "-syntax", "foo_test.treerack", "-input-string", "bar",
|
||||||
|
},
|
||||||
|
stdin: "invalid",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheck(t *testing.T) {
|
func TestCheck(t *testing.T) {
|
||||||
|
@ -112,6 +112,14 @@ var checkSyntaxTests = []mainTest{
|
|||||||
"treerack", "check-syntax", "-syntax-string", `foo = "bar"`,
|
"treerack", "check-syntax", "-syntax-string", `foo = "bar"`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "explicit over stdin",
|
||||||
|
args: []string{
|
||||||
|
"treerack", "check-syntax", "-syntax", "foo_test.treerack",
|
||||||
|
},
|
||||||
|
stdin: "invalid",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckSyntax(t *testing.T) {
|
func TestCheckSyntax(t *testing.T) {
|
||||||
|
@ -47,6 +47,40 @@ var generateTests = []mainTest{
|
|||||||
"func Parse",
|
"func Parse",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "default package name",
|
||||||
|
args: []string{
|
||||||
|
"treerack", "generate", "-export", "-syntax-string", `foo = "bar"`,
|
||||||
|
},
|
||||||
|
stdout: []string{
|
||||||
|
"package main",
|
||||||
|
"func Parse",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "no export",
|
||||||
|
args: []string{
|
||||||
|
"treerack", "generate", "-package-name", "foo", "-syntax-string", `foo = "bar"`,
|
||||||
|
},
|
||||||
|
stdout: []string{
|
||||||
|
"package foo",
|
||||||
|
"func parse",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "explicit over stdin",
|
||||||
|
args: []string{
|
||||||
|
"treerack", "generate", "-export", "-package-name", "foo", "-syntax", "foo_test.treerack",
|
||||||
|
},
|
||||||
|
stdin: "invalid",
|
||||||
|
stdout: []string{
|
||||||
|
"package foo",
|
||||||
|
"func Parse",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerate(t *testing.T) {
|
func TestGenerate(t *testing.T) {
|
||||||
|
@ -56,6 +56,17 @@ var parseTests = []mainTest{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: "explicit over stdin",
|
||||||
|
args: []string{
|
||||||
|
"treerack", "parse", "-syntax", "foo_test.treerack", "-input-string", "bar",
|
||||||
|
},
|
||||||
|
stdin: "invalid",
|
||||||
|
stdout: []string{
|
||||||
|
`"name":"foo"`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "pretty",
|
title: "pretty",
|
||||||
args: []string{
|
args: []string{
|
||||||
|
14
notes.txt
14
notes.txt
@ -1,19 +1,12 @@
|
|||||||
[next]
|
[next]
|
||||||
|
errors
|
||||||
formatter
|
formatter
|
||||||
report unused parsers
|
report unused parsers
|
||||||
parse hashed, storing only the results
|
parse hashed, storing only the results
|
||||||
linux packaging
|
linux packaging
|
||||||
|
|
||||||
[parser]
|
|
||||||
custom tokens
|
|
||||||
indentation
|
|
||||||
streaming support // ReadNode(io.Reader)
|
|
||||||
|
|
||||||
[cmd]
|
[cmd]
|
||||||
check
|
|
||||||
parse
|
|
||||||
help for positional argument
|
help for positional argument
|
||||||
test explicit input priority
|
|
||||||
|
|
||||||
[errors]
|
[errors]
|
||||||
take the last
|
take the last
|
||||||
@ -21,6 +14,11 @@ test error report on invalid flag
|
|||||||
input name: may be just dropped because completely controlled by the client
|
input name: may be just dropped because completely controlled by the client
|
||||||
input name needed in command to differentiate between syntax and input in check and parse subcommands
|
input name needed in command to differentiate between syntax and input in check and parse subcommands
|
||||||
|
|
||||||
|
[parser]
|
||||||
|
custom tokens
|
||||||
|
indentation
|
||||||
|
streaming support // ReadNode(io.Reader)
|
||||||
|
|
||||||
[generator]
|
[generator]
|
||||||
allchars: can have char sequence
|
allchars: can have char sequence
|
||||||
make generator output non-random (track parsers in a list in definition order)
|
make generator output non-random (track parsers in a list in definition order)
|
||||||
|
1134
self/self.go
1134
self/self.go
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user