rbx-linecache 0.43

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