Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text plist files with values beginning with / are not properly parsed #12

Closed
cwimberger opened this issue Mar 23, 2015 · 2 comments
Closed

Comments

@cwimberger
Copy link

We have a xcode project file where a key value pair looks like this: "shellPath = /bin/sh;".
When writing back the plist file, the key value pair becomes "shellPath = in/sh;".

I suspect there is a bug in the chugWhitespace function in the text.go file.

@cwimberger
Copy link
Author

I've created an unit test for the case. Seems like the chugWhitespace function would need a lookahead of 2, but UnreadByte() can only be called once.

func TestTextNoCommentDecode(t *testing.T) {
    var testData = "{A=/text;}"
    type D struct{ A string }
    actual := D{"/text"}
    var parsed D
    buf := bytes.NewReader([]byte(testData))
    decoder := NewDecoder(buf)
    err := decoder.Decode(&parsed)
    if err != nil {
        t.Error(err.Error())
    }

    if actual != parsed {
        t.Logf("Expected: %#v", actual)
        t.Logf("Received: %#v", parsed)
        t.Fail()
    }
}

@DHowett
Copy link
Owner

DHowett commented Mar 23, 2015

Great catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants