Skip to content

Commit

Permalink
Add error test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Apr 11, 2024
1 parent 7157890 commit 86b8de0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gems/aws-sdk-core/spec/aws/cbor/cbor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,26 @@ def expected_value(expect)
input = test_case['input']
as_bytes = [input].pack('H*')

if (expect = test_case['expect'])
actual = Aws::Cbor.decode(as_bytes)
expect(actual).to eq(expected_value(expect))
elsif test_case['error']
# TODO
end
expect = test_case['expect']
actual = Aws::Cbor.decode(as_bytes)
expect(actual).to eq(expected_value(expect))
end
end
end

context 'decode error tests' do
file = File.expand_path('decode-error-tests.json', __dir__)
test_cases = JSON.load_file(file)

test_cases.each do |test_case|
it "passes #{test_case['description']}" do
input = test_case['input']
as_bytes = [input].pack('H*')

# TODO: break this down into several errors somehow?
expect { Aws::Cbor.decode(as_bytes) }.to raise_error(OutOfBytesError)
end
end
end

end
Expand Down

0 comments on commit 86b8de0

Please sign in to comment.