From 4c1ce0f61cfc8988fa50dd48bb404f01d234eb7b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 23 Mar 2016 08:51:14 +0900 Subject: add safe-navigation operator tests --- test/t/nil.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/t/nil.rb b/test/t/nil.rb index 53b922f9a..27f70ad8c 100644 --- a/test/t/nil.rb +++ b/test/t/nil.rb @@ -32,3 +32,8 @@ end assert('NilClass#to_s', '15.2.4.3.5') do assert_equal '', nil.to_s end + +assert('safe navigation', '15.2.4.3.5') do + assert_nil nil&.size + assert_equal 0, []&.size +end -- cgit v1.2.3