linecache 0.46-java
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/COPYING +340 -0
- data/ChangeLog +620 -0
- data/NEWS +39 -0
- data/README +50 -0
- data/Rakefile +195 -0
- data/lib/linecache.rb +565 -0
- data/lib/linecache/trace_nums.rb +11 -0
- data/lib/linecache/tracelines.rb +46 -0
- data/lib/linecache/version.rb +3 -0
- data/test/data/begin1.rb +3 -0
- data/test/data/begin2.rb +3 -0
- data/test/data/begin3.rb +6 -0
- data/test/data/block1.rb +7 -0
- data/test/data/block2.rb +4 -0
- data/test/data/case1.rb +6 -0
- data/test/data/case2.rb +5 -0
- data/test/data/case3.rb +5 -0
- data/test/data/case4.rb +4 -0
- data/test/data/case5.rb +10 -0
- data/test/data/class1.rb +5 -0
- data/test/data/comments1.rb +6 -0
- data/test/data/def1.rb +9 -0
- data/test/data/each1.rb +3 -0
- data/test/data/end.rb +3 -0
- data/test/data/for1.rb +4 -0
- data/test/data/if1.rb +4 -0
- data/test/data/if2.rb +4 -0
- data/test/data/if3.rb +9 -0
- data/test/data/if4.rb +14 -0
- data/test/data/if5.rb +7 -0
- data/test/data/if6.rb +4 -0
- data/test/data/if7.rb +8 -0
- data/test/data/match.rb +3 -0
- data/test/data/match3.rb +5 -0
- data/test/data/match3a.rb +6 -0
- data/test/data/not-lit.rb +6 -0
- data/test/lnum-diag.rb +130 -0
- data/test/parse-show.rb +14 -0
- data/test/rcov-bug.rb +10 -0
- data/test/short-file +2 -0
- data/test/test-linecache.rb +151 -0
- data/test/test-lnum.rb +36 -0
- data/test/test-tracelines.rb +41 -0
- metadata +109 -0
data/test/test-lnum.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id$
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
# require 'rubygems'
|
6
|
+
# require 'ruby-debug'; Debugger.init
|
7
|
+
|
8
|
+
# Test TraceLineNumbers module
|
9
|
+
class TestLineNumbers2 < Test::Unit::TestCase
|
10
|
+
@@TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
11
|
+
@@TOP_SRC_DIR = File.join(@@TEST_DIR, '..')
|
12
|
+
require File.join(@@TOP_SRC_DIR, 'lib', 'linecache', 'tracelines.rb')
|
13
|
+
|
14
|
+
def test_all_lnum_data
|
15
|
+
test_dir = File.join(@@TEST_DIR, 'data')
|
16
|
+
Dir.chdir(test_dir) do
|
17
|
+
Dir.glob('*.rb').sort.each do |f|
|
18
|
+
puts f
|
19
|
+
fp = File.open(f, 'r')
|
20
|
+
lines = fp.read
|
21
|
+
fp.rewind
|
22
|
+
first_line = fp.readline.chomp
|
23
|
+
fp.close()
|
24
|
+
expected_str = first_line[1..-1]
|
25
|
+
begin
|
26
|
+
expected_lnums = eval(expected_str, binding, __FILE__, __LINE__)
|
27
|
+
rescue
|
28
|
+
assert nil, "Failed reading expected values from #{f}"
|
29
|
+
else
|
30
|
+
got_lnums = TraceLineNumbers.lnums_for_str(lines)
|
31
|
+
assert_equal(expected_lnums, got_lnums)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id$
|
3
|
+
require 'test/unit'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'tempfile'
|
6
|
+
|
7
|
+
# require 'rubygems'
|
8
|
+
# require 'ruby-debug'; Debugger.init
|
9
|
+
|
10
|
+
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
|
11
|
+
# Test TestLineNumbers module
|
12
|
+
class TestLineNumbers1 < Test::Unit::TestCase
|
13
|
+
|
14
|
+
@@TEST_DIR = File.expand_path(File.dirname(__FILE__))
|
15
|
+
@@TOP_SRC_DIR = File.join(@@TEST_DIR, '..', 'lib')
|
16
|
+
require File.join(@@TOP_SRC_DIR, 'linecache', 'tracelines.rb')
|
17
|
+
|
18
|
+
@@rcov_file = File.join(@@TEST_DIR, 'rcov-bug.rb')
|
19
|
+
File.open(@@rcov_file, 'r') {|fp|
|
20
|
+
first_line = fp.readline[1..-2]
|
21
|
+
@@rcov_lnums = eval(first_line, binding, __FILE__, __LINE__)
|
22
|
+
}
|
23
|
+
|
24
|
+
def test_for_file
|
25
|
+
rcov_lines = TraceLineNumbers.lnums_for_file(@@rcov_file)
|
26
|
+
assert_equal(@@rcov_lnums, rcov_lines)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_for_string
|
30
|
+
string = "# Some rcov bugs.\nz = \"\nNow is the time\n\"\n\nz =~ \n /\n 5\n /ix\n"
|
31
|
+
rcov_lines = TraceLineNumbers.lnums_for_str(string)
|
32
|
+
assert_equal([2, 9], rcov_lines)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_for_string_array
|
36
|
+
load(@@rcov_file, 0)
|
37
|
+
rcov_lines =
|
38
|
+
TraceLineNumbers.lnums_for_str_array(SCRIPT_LINES__[@@rcov_file])
|
39
|
+
assert_equal(@@rcov_lnums, rcov_lines)
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: linecache
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: "0.46"
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- R. Bernstein
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-10-06 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: |
|
18
|
+
LineCache is a module for reading and caching lines. This may be useful for
|
19
|
+
example in a debugger where the same lines are shown many times.
|
20
|
+
|
21
|
+
email: rockyb@rubyforge.net
|
22
|
+
executables: []
|
23
|
+
|
24
|
+
extensions: []
|
25
|
+
|
26
|
+
extra_rdoc_files:
|
27
|
+
- README
|
28
|
+
- lib/linecache.rb
|
29
|
+
- lib/linecache/tracelines.rb
|
30
|
+
files:
|
31
|
+
- AUTHORS
|
32
|
+
- COPYING
|
33
|
+
- ChangeLog
|
34
|
+
- NEWS
|
35
|
+
- README
|
36
|
+
- Rakefile
|
37
|
+
- lib/linecache.rb
|
38
|
+
- lib/linecache/trace_nums.rb
|
39
|
+
- lib/linecache/tracelines.rb
|
40
|
+
- lib/linecache/version.rb
|
41
|
+
- test/lnum-diag.rb
|
42
|
+
- test/parse-show.rb
|
43
|
+
- test/rcov-bug.rb
|
44
|
+
- test/test-linecache.rb
|
45
|
+
- test/test-lnum.rb
|
46
|
+
- test/test-tracelines.rb
|
47
|
+
- test/data/begin1.rb
|
48
|
+
- test/data/begin2.rb
|
49
|
+
- test/data/begin3.rb
|
50
|
+
- test/data/block1.rb
|
51
|
+
- test/data/block2.rb
|
52
|
+
- test/data/case1.rb
|
53
|
+
- test/data/case2.rb
|
54
|
+
- test/data/case3.rb
|
55
|
+
- test/data/case4.rb
|
56
|
+
- test/data/case5.rb
|
57
|
+
- test/data/class1.rb
|
58
|
+
- test/data/comments1.rb
|
59
|
+
- test/data/def1.rb
|
60
|
+
- test/data/each1.rb
|
61
|
+
- test/data/end.rb
|
62
|
+
- test/data/for1.rb
|
63
|
+
- test/data/if1.rb
|
64
|
+
- test/data/if2.rb
|
65
|
+
- test/data/if3.rb
|
66
|
+
- test/data/if4.rb
|
67
|
+
- test/data/if5.rb
|
68
|
+
- test/data/if6.rb
|
69
|
+
- test/data/if7.rb
|
70
|
+
- test/data/match.rb
|
71
|
+
- test/data/match3.rb
|
72
|
+
- test/data/match3a.rb
|
73
|
+
- test/data/not-lit.rb
|
74
|
+
- test/short-file
|
75
|
+
has_rdoc: true
|
76
|
+
homepage: http://rubyforge.org/projects/rocky-hacks/linecache
|
77
|
+
licenses: []
|
78
|
+
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.8.7
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project: rocky-hacks
|
99
|
+
rubygems_version: 1.5.1
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: Read file with caching
|
103
|
+
test_files:
|
104
|
+
- test/lnum-diag.rb
|
105
|
+
- test/parse-show.rb
|
106
|
+
- test/rcov-bug.rb
|
107
|
+
- test/test-linecache.rb
|
108
|
+
- test/test-lnum.rb
|
109
|
+
- test/test-tracelines.rb
|