-
Notifications
You must be signed in to change notification settings - Fork 7
Defaults #297
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
Defaults #297
Changes from 17 commits
5e4c880
a4aac5b
8db39a1
688829d
ae78f16
67fa77d
2220b93
7cffe7d
5d37bc0
9662011
0b3bb17
7e1cadc
583e1a1
8301c53
3045d7f
927c26b
9cd1318
3da4fa0
c759002
7f8c65a
748557a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,31 +83,13 @@ module CBOR | |
| expect(subject.deserialize(shape, bytes).union).to eq(nil) | ||
| end | ||
|
|
||
| it 'serializes an empty union' do | ||
| data = { union: {} } | ||
| bytes = subject.serialize(shape, data) | ||
| expect(subject.deserialize(shape, bytes).union).to eq(nil) | ||
| end | ||
|
|
||
| it 'serializes nil union values' do | ||
| data = { union: { string: nil } } | ||
| bytes = subject.serialize(shape, data) | ||
| expect(subject.deserialize(shape, bytes).to_h).to eq(data) | ||
| end | ||
|
|
||
| it 'deserializes unknown union members' do | ||
| unknown_union_type = shape.member(:union).shape.member_type(:unknown) | ||
| data = { union: { 'someThing' => 'someValue' } } | ||
| deserialized = subject.deserialize(shape, CBOR.encode(data)) | ||
| expect(deserialized.union).to be_a(unknown_union_type) | ||
| expect(deserialized.union.to_h).to eq(unknown: { name: 'someThing', value: 'someValue' }) | ||
| end | ||
|
|
||
| it 'raises when deserializing unions with more than one member' do | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason we're removing these tests?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was wrong behavior when I had chatted with Kevin. I'm not really sure if we should be raising. Let me think on this. |
||
| data = { union: { string: 'string', integer: 1 } } | ||
| expect { subject.deserialize(shape, CBOR.encode(data)) } | ||
| .to raise_error(ArgumentError, /union value includes more than one key/) | ||
| end | ||
| end | ||
|
|
||
| context 'lists' do | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'base64' | ||
| require 'jmespath' | ||
|
|
||
| require 'smithy-cbor' | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.