Make use of generics instead of a method (#2)

* Allows Crystal to more accurately know the return type of `ordered_elements`
* Add example of `ordered_elements` usage
This commit is contained in:
George Dietrich 2020-12-24 01:07:51 -05:00 committed by GitHub
parent 83eda1298c
commit 96fe9291e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 32 deletions

View file

@ -112,6 +112,8 @@ struct NegotiatorTest < NegotiatorTestCase
def test_ordered_elements(header : String, expected : Indexable(String)) : Nil
elements = @negotiator.ordered_elements header
elements.should be_a Array(ANG::Accept)
expected.each_with_index do |element, idx|
elements[idx].should be_a ANG::Accept
element.should eq elements[idx].header