mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 19:47:10 +00:00
fix(implementation-sweep): name every missing required flag, in flag order
This commit is contained in:
1 parent
5892983ff8
commit
627f9eeeff
2 files changed
+46
-7
No files matched your search
@@ -143,6 +143,33 @@ func TestParseArguments_Rejections(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Three flags missing is one rerun, not three: the operator is told about all
|
||||
// of them at once, in flag order, whatever order the check happened to walk.
|
||||
func TestParseArguments_NamesEveryMissingRequiredFlagInFlagOrder(t *testing.T) {
|
||||
_, err := parseArguments(
|
||||
[]string{"--spec", "s", "--max-steps", "10"},
|
||||
io.Discard,
|
||||
)
|
||||
if err == nil {
|
||||
t.Fatal("got no error, want every missing flag named")
|
||||
}
|
||||
message := err.Error()
|
||||
previous := -1
|
||||
for _, name := range []string{"--implementations", "--seeds", "--output"} {
|
||||
at := strings.Index(message, name)
|
||||
if at < 0 {
|
||||
t.Fatalf("got %q, want %s named", message, name)
|
||||
}
|
||||
if at < previous {
|
||||
t.Errorf("got %q, want the flags named in flag order", message)
|
||||
}
|
||||
previous = at
|
||||
}
|
||||
if strings.Contains(message, "--spec") {
|
||||
t.Errorf("got %q, want the supplied --spec left out", message)
|
||||
}
|
||||
}
|
||||
|
||||
// The seed reaches two independent things, the campaign's own seed and the
|
||||
// scaffold's failure stream, and a replay reproduces neither unless they carry
|
||||
// the same number.
|
||||
|
||||
Reference in new issue
Block a user