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

Struct tests are failing in IonHashTest.ion #8

Open
byronlin13 opened this issue Jan 29, 2020 · 2 comments
Open

Struct tests are failing in IonHashTest.ion #8

byronlin13 opened this issue Jan 29, 2020 · 2 comments

Comments

@byronlin13
Copy link
Contributor

Scenarios:

ion:{$0:1}
ion:{               
    'null':null,
    bool:false,
    int:5,
    neg_int:-6,
    float:4.9e-324,
    decimal:123.45,
    timestamp:2017-01-01T00:00:00-00:00,
    symbol:hello,
    string:"hello",
    clob:{{"hello"}},
    blob:{{aGVsbG8=}},
    list:[1,2,3],
    sexp:(1 2 3),
    struct:{},
    annotated_value:hello::{},
}
@byronlin13
Copy link
Contributor Author

scenario: {$0:1} is failing on IonHashWriterTest.cs and returning System.InvalidOperationException: In a struct but field name is not set exception.

The test creates a reader that reads the struct and is passed into writer.writeValues(). As the reader moves next to $0 symbol, the CurrentFieldName is called but is not written to the writer because it is null. When the writer tries to write 1, the field name is not set and the exception is thrown.

The fix is to call SetFieldNameSymbol() instead of SetFieldName() so the zero symbol is set to the writer.

https://github.com/amzn/ion-hash-dotnet/blob/master/Amazon.IonHashDotnet/IonHashWriter.cs#L262-L266

@byronlin13
Copy link
Contributor Author

The zero symbol struct scenario: {$0:1} has been resolved by PR: #21

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

1 participant