emp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/test/unit/show_code.rb +57 -0
  2. metadata +45 -0
@@ -0,0 +1,57 @@
1
+ module Test::Unit
2
+ class << self
3
+ def _load_line(location)
4
+ file, line = location.split(":", 2)
5
+ line_no = line.to_i
6
+
7
+ return nil unless File.exists?(file)
8
+ return nil if line_no <= 0
9
+ File.open(file) do |f|
10
+ line = f.gets while f.lineno < line_no
11
+
12
+ return line.strip
13
+ end
14
+
15
+ return nil
16
+ end
17
+ end
18
+ end
19
+
20
+ class Test::Unit::Failure
21
+ undef :long_display
22
+
23
+
24
+ def long_display
25
+ code = nil
26
+ location_display = if(location.size == 1)
27
+ out = location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
28
+ code = Test::Unit._load_line($1)
29
+ out
30
+ else
31
+ "\n [#{location.join("\n ")}]"
32
+ end
33
+
34
+ if code
35
+ "Failure:\n#@test_name#{location_display}\n => #{code}\n#@message"
36
+ else
37
+ "Failure:\n#@test_name#{location_display}:\n#@message"
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ class Test::Unit::Error
44
+ undef :long_display
45
+
46
+ def long_display
47
+ backtrace = filter_backtrace(@exception.backtrace)
48
+ out = backtrace[0].sub(/\A(.+:\d+).*/, '\\1')
49
+ code = Test::Unit._load_line(out)
50
+ backtrace = backtrace.join("\n ")
51
+ if code
52
+ "Error:\n#@test_name:\n#{message}\n => #{code}\n #{backtrace}"
53
+ else
54
+ "Error:\n#@test_name:\n#{message}\n #{backtrace}"
55
+ end
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: emp
5
+ version: !ruby/object:Gem::Version
6
+ version: 1.0.0
7
+ date: 2006-07-15 00:00:00 -07:00
8
+ summary: A number of extensions that Evan Phoenix uses.
9
+ require_paths:
10
+ - lib
11
+ email: evan@fallingsnow.net
12
+ homepage:
13
+ rubyforge_project:
14
+ description:
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: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Evan Phoenix
30
+ files:
31
+ - lib/test/unit/show_code.rb
32
+ test_files: []
33
+
34
+ rdoc_options: []
35
+
36
+ extra_rdoc_files: []
37
+
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ requirements: []
43
+
44
+ dependencies: []
45
+