Show the ninja string that failed to parse in errors am: c5baf11a2d

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2393625

Change-Id: Ie6c2eac046adda1bd4a2a57c33658fdc8c6b01a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Cole Faust 2023-01-20 00:21:49 +00:00 committed by Automerger Merge Worker
commit c03d43564a
2 changed files with 4 additions and 4 deletions

View file

@ -118,7 +118,7 @@ func parseNinjaString(scope scope, str string) (ninjaString, error) {
r := rune(str[i]) r := rune(str[i])
state, err = state(parseState, i, r) state, err = state(parseState, i, r)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("error parsing ninja string %q: %s", str, err)
} }
} }

View file

@ -87,7 +87,7 @@ var ninjaParseTestCases = []struct {
strs: []string{"$ ", " "}, strs: []string{"$ ", " "},
}, { }, {
input: "foo $ bar", input: "foo $ bar",
err: "invalid character after '$' at byte offset 5", err: `error parsing ninja string "foo $ bar": invalid character after '$' at byte offset 5`,
}, },
{ {
input: "foo $", input: "foo $",
@ -95,11 +95,11 @@ var ninjaParseTestCases = []struct {
}, },
{ {
input: "foo ${} bar", input: "foo ${} bar",
err: "empty variable name at byte offset 6", err: `error parsing ninja string "foo ${} bar": empty variable name at byte offset 6`,
}, },
{ {
input: "foo ${abc!} bar", input: "foo ${abc!} bar",
err: "invalid character in variable name at byte offset 9", err: `error parsing ninja string "foo ${abc!} bar": invalid character in variable name at byte offset 9`,
}, },
{ {
input: "foo ${abc", input: "foo ${abc",