Changeset 331 for EcnlProtoTool/trunk/mruby-1.3.0/test/t/array.rb
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-1.3.0
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-1.3.0/test/t/array.rb
r321 r331 12 12 assert('Array.[]', '15.2.12.4.1') do 13 13 assert_equal([1, 2, 3], Array.[](1,2,3)) 14 end 15 16 class SubArray < Array 17 end 18 19 assert('SubArray.[]') do 20 a = SubArray[1, 2, 3] 21 assert_equal(SubArray, a.class) 14 22 end 15 23 … … 83 91 a[2...4] = 6 84 92 assert_equal([1,2,6,5], a) 93 94 # passing self (#3274) 95 a = [1,2,3] 96 a[1,0] = a 97 assert_equal([1,1,2,3,2,3], a) 98 a = [1,2,3] 99 a[-1,0] = a 100 assert_equal([1,2,1,2,3,3], a) 85 101 end 86 102 … … 99 115 assert('Array#concat', '15.2.12.5.8') do 100 116 assert_equal([1,2,3,4], [1, 2].concat([3, 4])) 117 118 # passing self (#3302) 119 a = [1,2,3] 120 a.concat(a) 121 assert_equal([1,2,3,1,2,3], a) 101 122 end 102 123 … … 319 340 a = [ 1, 2, 3 ] 320 341 321 assert_true(a.hash.is_a? Integer) 342 #assert_true(a.hash.is_a? Integer) 343 assert_true(a.hash.is_a? Integral) # mruby special 322 344 assert_equal([1,2].hash, [1,2].hash) 323 345 end … … 348 370 assert_equal({Array=>200}, h) 349 371 end 372 373 assert("Array#rindex") do 374 class Sneaky 375 def ==(*) 376 $a.clear 377 $a.replace([1]) 378 false 379 end 380 end 381 $a = [2, 3, 4, 5, 6, 7, 8, 9, 10, Sneaky.new] 382 assert_equal 0, $a.rindex(1) 383 end 384 385 assert('Array#freeze') do 386 a = [].freeze 387 assert_raise(RuntimeError) do 388 a[0] = 1 389 end 390 end
Note:
See TracChangeset
for help on using the changeset viewer.