1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using ICSharpCode.SharpDevelop.Dom;
6
using System.Text.RegularExpressions;
7
using ICSharpCode.UnitTesting;
9
namespace ICSharpCode.RubyBinding
11
public class RubyTestResult : TestResult
13
public RubyTestResult(TestResult testResult)
14
: base(testResult.Name)
16
ResultType = testResult.ResultType;
17
Message = testResult.Message;
18
StackTrace = testResult.StackTrace;
21
protected override void OnStackTraceChanged()
23
if (String.IsNullOrEmpty(StackTrace)) {
24
ResetStackTraceFilePosition();
26
GetFilePositionFromStackTrace();
30
void ResetStackTraceFilePosition()
32
StackTraceFilePosition = FilePosition.Empty;
36
/// Stack trace: Failure:
37
/// test_fail(SecondTests)
38
/// [d:\temp\test\rubytests\SecondTests.rb:6:in `test_fail'
39
/// d:\temp\test\rubytests/sdtestrunner.rb:73:in `start_mediator'
40
/// d:\temp\test\rubytests/sdtestrunner.rb:47:in `start']:
41
/// Assertion was false.
42
/// <false> is not true.
44
void GetFilePositionFromStackTrace()
46
Match match = Regex.Match(StackTrace, "\\s\\[(.*?):(\\d+):", RegexOptions.Multiline);
49
SetStackTraceFilePosition(match.Groups);
50
} catch (OverflowException) {
56
void SetStackTraceFilePosition(GroupCollection groups)
58
string fileName = groups[1].Value;
59
int line = Convert.ToInt32(groups[2].Value);
62
StackTraceFilePosition = new FilePosition(fileName, line, column);