linecache 0.41-mswin32
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 +330 -0
- data/NEWS +25 -0
- data/README +38 -0
- data/Rakefile +162 -0
- data/VERSION +1 -0
- data/ext/extconf.rb +16 -0
- data/ext/trace_nums.c +716 -0
- data/ext/trace_nums.h +111 -0
- data/lib/linecache.rb +399 -0
- data/lib/trace_nums.so +0 -0
- data/lib/tracelines.rb +42 -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 +94 -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', '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: test-tracelines.rb 51 2008-01-26 10:18:26Z rockyb $
|
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, '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,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.4
|
3
|
+
specification_version: 1
|
4
|
+
name: linecache
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: "0.41"
|
7
|
+
date: 2008-04-10 00:00:00 -04:00
|
8
|
+
summary: Read file with caching
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: rockyb@rubyforge.net
|
12
|
+
homepage: http://rubyforge.org/projects/rocky-hacks/linecache
|
13
|
+
rubyforge_project: rocky-hacks
|
14
|
+
description: LineCache is a module for reading and caching lines. This may be useful for example in a debugger where the same lines are shown many times.
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.8.2
|
24
|
+
version:
|
25
|
+
platform: mswin32
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- R. Bernstein
|
31
|
+
files:
|
32
|
+
- AUTHORS
|
33
|
+
- COPYING
|
34
|
+
- ChangeLog
|
35
|
+
- NEWS
|
36
|
+
- README
|
37
|
+
- Rakefile
|
38
|
+
- VERSION
|
39
|
+
- ext/trace_nums.c
|
40
|
+
- ext/trace_nums.h
|
41
|
+
- ext/extconf.rb
|
42
|
+
- lib/tracelines.rb
|
43
|
+
- lib/linecache.rb
|
44
|
+
- test/rcov-bug.rb
|
45
|
+
- test/test-tracelines.rb
|
46
|
+
- test/test-lnum.rb
|
47
|
+
- test/test-linecache.rb
|
48
|
+
- test/parse-show.rb
|
49
|
+
- test/lnum-diag.rb
|
50
|
+
- test/data/for1.rb
|
51
|
+
- test/data/if6.rb
|
52
|
+
- test/data/comments1.rb
|
53
|
+
- test/data/if3.rb
|
54
|
+
- test/data/if5.rb
|
55
|
+
- test/data/begin3.rb
|
56
|
+
- test/data/end.rb
|
57
|
+
- test/data/case1.rb
|
58
|
+
- test/data/match.rb
|
59
|
+
- test/data/begin2.rb
|
60
|
+
- test/data/match3.rb
|
61
|
+
- test/data/case5.rb
|
62
|
+
- test/data/not-lit.rb
|
63
|
+
- test/data/match3a.rb
|
64
|
+
- test/data/if7.rb
|
65
|
+
- test/data/if4.rb
|
66
|
+
- test/data/case2.rb
|
67
|
+
- test/data/block2.rb
|
68
|
+
- test/data/begin1.rb
|
69
|
+
- test/data/def1.rb
|
70
|
+
- test/data/if1.rb
|
71
|
+
- test/data/class1.rb
|
72
|
+
- test/data/if2.rb
|
73
|
+
- test/data/block1.rb
|
74
|
+
- test/data/case3.rb
|
75
|
+
- test/data/each1.rb
|
76
|
+
- test/data/case4.rb
|
77
|
+
- test/short-file
|
78
|
+
- lib/trace_nums.so
|
79
|
+
test_files: []
|
80
|
+
|
81
|
+
rdoc_options: []
|
82
|
+
|
83
|
+
extra_rdoc_files:
|
84
|
+
- README
|
85
|
+
- lib/linecache.rb
|
86
|
+
- lib/tracelines.rb
|
87
|
+
executables: []
|
88
|
+
|
89
|
+
extensions: []
|
90
|
+
|
91
|
+
requirements: []
|
92
|
+
|
93
|
+
dependencies: []
|
94
|
+
|