Sha256: 593ee8c2f5f1d65702ad43dc607d6010fd5ddf8bf4c8d2896e6083ab517f6a22

Contents?: true

Size: 1.22 KB

Versions: 81

Compression:

Stored size: 1.22 KB

Contents

module PKCS7Test
  class TestJavaBIO < Test::Unit::TestCase
    def test_string_bio_simple
      bio = BIO::from_string("abc")
      arr = Java::byte[20].new
      read = bio.gets(arr, 10)
      assert_equal 3, read
      assert_equal "abc".to_java_bytes.to_a, arr.to_a[0...read]
    end

    def test_string_bio_simple_with_newline
      bio = BIO::from_string("abc\n")
      arr = Java::byte[20].new
      read = bio.gets(arr, 10)
      assert_equal 4, read
      assert_equal "abc\n".to_java_bytes.to_a, arr.to_a[0...read]
    end

    def test_string_bio_simple_with_newline_and_more_data
      bio = BIO::from_string("abc\nfoo\n\nbar")
      arr = Java::byte[20].new
      read = bio.gets(arr, 10)
      assert_equal 4, read
      assert_equal "abc\n".to_java_bytes.to_a, arr.to_a[0...read]

      read = bio.gets(arr, 10)
      assert_equal 4, read
      assert_equal "foo\n".to_java_bytes.to_a, arr.to_a[0...read]
    
      read = bio.gets(arr, 10)
      assert_equal 1, read
      assert_equal "\n".to_java_bytes.to_a, arr.to_a[0...read]

      read = bio.gets(arr, 10)
      assert_equal 3, read
      assert_equal "bar".to_java_bytes.to_a, arr.to_a[0...read]

      read = bio.gets(arr, 10)
      assert_equal 0, read
    end
  end
end

Version data entries

81 entries across 81 versions & 6 rubygems

Version Path
jruby-jruby-openssl-0.5.0.4 test/test_java_bio.rb
jruby-openssl-0.9.4 test/java/test_java_bio.rb
jruby-openssl-0.9.3 test/java/test_java_bio.rb
jruby-openssl-0.9.2 test/java/test_java_bio.rb
jruby-openssl-0.9.1 test/java/test_java_bio.rb
jruby-openssl-0.8.10 test/java/test_java_bio.rb
jruby-openssl-0.9.0 test/java/test_java_bio.rb
jruby-openssl-0.8.9 test/java/test_java_bio.rb
jruby-openssl-0.8.9.dev test/java/test_java_bio.rb
jruby-openssl-0.8.8 test/java/test_java_bio.rb
jruby-openssl-0.8.7 test/java/test_java_bio.rb
jruby-openssl-0.8.7.dev test/java/test_java_bio.rb
jruby-openssl-0.8.6 test/java/test_java_bio.rb
jruby-openssl-0.8.5 test/java/test_java_bio.rb
jruby-openssl-0.8.4 test/java/test_java_bio.rb
jruby-openssl-0.8.2 test/java/test_java_bio.rb
jruby-openssl-0.8.1 test/java/test_java_bio.rb
jruby-openssl-0.8.0 test/java/test_java_bio.rb
jruby-openssl-0.8.0.pre3 test/java/test_java_bio.rb
jruby-openssl-0.8.0.pre2 test/java/test_java_bio.rb