Skip to content

Commit

Permalink
[Truffle] Better class name generation for mspec reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Feb 24, 2015
1 parent b3c8775 commit aeb6a71
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions spec/truffle/truffle_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ def start
def load
parts = MSpec.retrieve(:file).sub(Dir.pwd + '/', '').split('/')

@spec_type = parts[0...2].join('.')
@classname = parts[2...-1].join('_')
@spec_type = parts[0...3].join('.')
@class_name = parts[3...-1].join('_')

@class_name = 'Ruby' if @class_name.empty?

@filename_base = parts[-1].split('.rb').first.split('_spec').first

@tests.clear
@file_time = current_time

(@local_tally = TallyAction.new).register

@testsuite_name = [@spec_type, @classname, @filename_base].compact.join('.')
@dir = File.join('tmp', @spec_type, @classname)
@testsuite_name = [@spec_type, @class_name, @filename_base].compact.join('.')
@dir = File.join('tmp', @spec_type, @class_name)

mkdir_p(@dir)

Expand Down Expand Up @@ -93,7 +96,7 @@ def unload
description = encode_for_xml h[:test].description

@file.puts <<-XML
<testcase classname="#{@classname}" name="#{description}" time="#{h[:time]}">
<testcase classname="#{@class_name}" name="#{description}" time="#{h[:time]}">
XML

if h[:exception]
Expand Down

0 comments on commit aeb6a71

Please sign in to comment.