public
Fork of dchelimsky/rspec
Description: Behaviour Driven Development framework for Ruby
Homepage: http://rspec.info
Clone URL: git://github.com/jpshackelford/rspec.git
SpecParser now handles backtrace paths which contain colons (common on Windows). 
Lighthouse Ticket #505
jpshackelford (author)
Fri Aug 22 12:34:51 -0700 2008
commit  466b8e27e36bb0e6073a460f01341882ee881d8c
tree    dafb045043f7412e4787db21aafad7443ffd09c3
parent  a8bbb6de851579f10bed69123e8257b3d762d31a
...
62
63
64
65
66
 
 
 
 
 
67
68
 
69
70
71
...
62
63
64
 
 
65
66
67
68
69
70
71
72
73
74
75
0
@@ -62,10 +62,14 @@ module Spec
0
 
0
       def parse_backtrace(backtrace)
0
         backtrace.collect do |trace_line|
0
-          split_line = trace_line.split(':')
0
-          [split_line[0], Integer(split_line[1])]
0
+          # match c:/somepath/file.rb:999:in 'method'
0
+          # -or-  ./somepath.file.rb:999
0
+          trace_line =~ /(.*)\:(\d*)(\:|$)/
0
+          file, number = $1, $2
0
+          [file, Integer(number)]
0
         end
0
       end
0
+
0
     end
0
   end
0
 end
...
82
83
84
 
 
 
 
 
 
 
 
 
85
...
82
83
84
85
86
87
88
89
90
91
92
93
94
0
@@ -82,4 +82,13 @@ describe "SpecParser" do
0
     parser.spec_name_for(file, 63).should == "e f 11"
0
   end
0
 
0
+  it "should handle paths which contain colons" do
0
+    fixture =
0
+       { "c:/somepath/somefile.rb:999:in 'method'" => "c:/somepath/somefile.rb",
0
+         "./somepath/somefile:999"                 => "./somepath/somefile" }
0
+    fixture.each_pair do |input, expected|
0
+      parser.send(:parse_backtrace, input ).should == [[expected, 999]]
0
+    end
0
+  end
0
+
0
 end

Comments