Skip to content

Commit f0b5cdd

Browse files
committed
Actually make -print-skip print a valid bash script
Previously it was only valid with zsh; seems bash really wants those curly braces.
1 parent e7098e2 commit f0b5cdd

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

cmd/toml-test/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ func main() {
209209
fmt.Printf(", %2d skipped", tests.Skipped)
210210
}
211211
if printSkip && (tests.FailedValid > 0 || tests.FailedInvalid > 0) {
212-
fmt.Print("\n\n #!/usr/bin/env bash\n skip=(\n")
212+
fmt.Print("\n\n #!/usr/bin/env bash\n # Also compatible with zsh.\n skip=(\n")
213213
for _, f := range tests.Tests {
214214
if f.Failed() {
215215
fmt.Printf(" -skip '%s'\n", f.Path)
216216
}
217217
}
218218
fmt.Println(" )")
219-
fmt.Print(" toml-test $skip[@] " + strings.Join(cmd, " "))
219+
fmt.Print(" toml-test ${skip[@]} " + strings.Join(cmd, " "))
220220
if runner.Encoder {
221221
fmt.Print(" -encoder")
222222
}

cmd/toml-test/usage.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ Flags:
9999
-parallel Number of tests to run in parallel; defaults to GOMAXPROCS,
100100
normally the number of cores available.
101101
102-
-print-skip Print a small bash script with -skip flag for failing tests;
103-
useful to get a list of "known failures" for CI integrations
104-
and such.
102+
-print-skip Print a small bash/zsh script with -skip flag for failing
103+
tests; useful to get a list of "known failures" for CI
104+
integrations and such.
105105
106106
-int-as-float Treat all integers as floats, rather than integers. This also
107107
skips the int64 test as that's outside of the safe float

tests/valid/spec/string-6.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"regex2": {"type": "string", "value": "I [dw]on't need \\d{2} apples"},
3-
"lines": {
4-
"type": "string",
5-
"value": "The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n"
6-
}
2+
"lines": {"type": "string", "value": "The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n"},
3+
"regex2": {"type": "string", "value": "I [dw]on't need \\d{2} apples"}
74
}

0 commit comments

Comments
 (0)