Sha256: fde7f507c2341ac3da95d11b4b810d479f34dee2f2bed6c5434d799b86772460

Contents?: true

Size: 865 Bytes

Versions: 102

Compression:

Stored size: 865 Bytes

Contents

require "test-unit"
require "testunit-test-util"

class TestCodeSnippet < Test::Unit::TestCase
  include TestUnitTestUtil

  class TestJRuby < self
    def test_error_inside_jruby
      jruby_only_test

      backtrace = backtrace_from_jruby
      no_rb_entries = backtrace.find_all do |(file, _, _)|
        File.extname(file) != ".rb"
      end

      fetcher = Test::Unit::CodeSnippetFetcher.new
      snippets = no_rb_entries.collect do |(file, line, _)|
        fetcher.fetch(file, line)
      end
      assert_equal([[]] * no_rb_entries.size,
                   snippets)
    end

    private
    def backtrace_from_jruby
      begin
        java.util.Vector.new(-1)
      rescue Exception
        $@.collect do |entry|
          entry.split(/:/, 3)
        end
      else
        flunk("failed to raise an exception from JRuby.")
      end
    end
  end
end

Version data entries

102 entries across 80 versions & 13 rubygems

Version Path
postfinancecheckout-ruby-sdk-3.3.0 vendor/bundle/ruby/2.7.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
wallee-ruby-sdk-3.3.0 vendor/bundle/ruby/2.7.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.2.1 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
wallee-ruby-sdk-3.2.0 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
postfinancecheckout-ruby-sdk-3.2.0 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
wallee-ruby-sdk-3.1.5 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
postfinancecheckout-ruby-sdk-3.1.5 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.2.0 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.9 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.8 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.7 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.6 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.5 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
postfinancecheckout-ruby-sdk-3.1.4 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.4 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
wallee-ruby-sdk-3.1.4 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
wallee-ruby-sdk-3.1.3 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.3 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
whitelabelmachinename-ruby-sdk-3.1.2 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb
wallee-ruby-sdk-3.1.2 vendor/bundle/ruby/2.4.0/gems/test-unit-3.2.9/test/test-code-snippet.rb