Class: TestKernel

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/innate/test/testkernel.rb

Instance Method Summary collapse

Instance Method Details

#test_each_callerObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/innate/test/testkernel.rb', line 18

def test_each_caller
  c = -1
  each_caller do |file, line, method|  # <- the below test wants the line number of this line
    c += 1
    if c == 0
      assert_equal File.expand_path(__FILE__), File.expand_path(file)
      assert_equal 20, line 
      assert_equal 'test_each_caller', method
    end
  end
  assert_equal c, caller.length
end

#test_each_loaded_fileObject



11
12
13
14
15
16
# File 'lib/innate/test/testkernel.rb', line 11

def test_each_loaded_file
  c = $".to_cursor
  each_loaded_file do |f|
    assert_match Regexp.new(Regexp.escape(c.read1next)), f
  end
end

#test_find_in_pathObject



6
7
8
9
# File 'lib/innate/test/testkernel.rb', line 6

def test_find_in_path
  #this assumes that the lib exists in ..../site_ruby/innate/kernel.rb
  assert_equal File.expand_path('../kernel.rb').downcase, find_in_path('innate/kernel').downcase
end