File: test_frame_self.rb

package info (click to toggle)
jruby 1.5.1-1
  • links: PTS, VCS
  • area: non-free
  • in suites: squeeze
  • size: 46,252 kB
  • ctags: 72,039
  • sloc: ruby: 398,155; java: 169,482; yacc: 3,782; xml: 2,469; ansic: 415; sh: 279; makefile: 78; tcl: 40
file content (40 lines) | stat: -rw-r--r-- 736 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'test/unit'

# Test for issue JIRA-2418
# This fails with "protected method `protected_2' called for #<Issue2418:0xfa39bb> (NoMethodError)"
# in JRuby 1.1.1, works in MRI 1.8
# Author: steen.lehmann@jayway.dk

class TestFrameSelf < Test::Unit::TestCase
  
  class Issue2418
    
    def unprotected
      protected_1('current')
    end

    def method_missing(method, *args)
      false
    end
    
  protected

    def protected_1(span_class)
      # This line causes the issue
      classnames = Array[*span_class]

      protected_2
    end

    def protected_2
      true
    end

  end

  def test_frame_self
    assert Issue2418.new.unprotected,
      "Frame is set correctly, and method_missing not called"
  end
  
end