Runtime assertions for Ruby literal.fun
ruby
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implements `#reverse!` in Literal::Array (#298)

Addresses #193

authored by

Salazar and committed by
GitHub
dca4714a bf5f3ab7

+13
+5
lib/literal/array.rb
··· 499 499 500 500 alias_method :initialize_copy, :replace 501 501 502 + def reverse! 503 + @__value__.reverse! 504 + self 505 + end 506 + 502 507 def rotate(...) 503 508 __with__(@__value__.rotate(...)) 504 509 end
+8
test/array.test.rb
··· 768 768 assert_equal return_value, Literal::Array(Integer).new(2, 3, 1) 769 769 end 770 770 771 + test "#reverse! reverses the array in place" do 772 + array = Literal::Array(Integer).new(1, 2, 3) 773 + 774 + return_value = array.reverse! 775 + 776 + assert_same return_value, array 777 + end 778 + 771 779 test "#take takes the first n elements" do 772 780 array = Literal::Array(Integer).new(1, 2, 3, 4, 5) 773 781