Repository: apache/arrow
File: ruby/red-arrow/test/test-array-builder.rb (Ruby)

Code before:
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int8>s") do
          values = [
            [0, -1, 2],
            [3, 4],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(Arrow::Int8DataType.new)
          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, -1, 2],
                           [3, 4],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int8>s boundary") do
          # Int8 can hold values from -128 to 127.
          values = [
            [0, -2**7],
            [2**7 - 1],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(Arrow::Int8DataType.new)

          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, -128],
                           [127],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s inferred from int8 underflow") do
          values = [

Review comment (refactor):
Can we remove this test because `list<int8>s boundary` test covers this case?

Code after:
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int8>s boundary") do
          values = [
            [0, GLib::MININT8],
            [GLib::MAXINT8],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(:int8)

          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, GLib::MININT8],
                           [GLib::MAXINT8],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s inferred from int8 underflow") do
          values = [
            [0, GLib::MININT8 - 1],
            [GLib::MAXINT8],
          ]
          array = Arrow::Array.new(values)
          data_type = Arrow::ListDataType.new(:int16)

          assert_equal({
                         data_type: data_type,
                         values: [
                           [0, GLib::MININT8 - 1],
                           [GLib::MAXINT8],
                         ],
                       },
                       {
                         data_type: array.value_data_type,
                         values: array.to_a,
                       })
        end

        test("list<int16>s inferred from int8 overflow") do
          values = [