public void TestParsingCompilerWarningSourceEntries() { string line = "[E]: Assets/Editor/Console/ConsoleView.cs(637,18): error CS1525: Unexpected symbol `if', expecting `)', `,', `;', `[', or `='"; SourcePathEntry expected = new SourcePathEntry("Assets/Editor/Console/ConsoleView.cs", 637); SourcePathEntry actual; bool succeed = EditorStackTrace.TryParseCompilerMessage(line, out actual); Assert.IsTrue(succeed); Assert.AreEqual(expected.IsValid, actual.IsValid); Assert.AreEqual(expected.sourcePath, actual.sourcePath); Assert.AreEqual(expected.lineNumber, actual.lineNumber); }
public static bool TryParseCompilerMessage(string line, out SourcePathEntry entry) { if (line != null) { Match m = PatternCompilerMessageSourcePath.Match(line); if (m.Success) { string path = m.Groups[1].Value; int lineNumber = StringUtils.ParseInt(m.Groups[2].Value, -1); entry = new SourcePathEntry(path, lineNumber); return(true); } } entry = SourcePathEntry.Invalid; return(false); }
public static bool TryParse(string line, out SourcePathEntry element) { Match match = Pattern.Match(line); if (match.Success) { string path = match.Groups[1].ToString(); string lineVal = match.Groups[2].ToString(); int lineNumber; if (int.TryParse(lineVal, out lineNumber)) { element = new SourcePathEntry(path, lineNumber); return(true); } } element = SourcePathEntry.Invalid; return(false); }
public static bool TryParse(string line, out SourcePathEntry element) { Match match = Pattern.Match(line); if (match.Success) { string path = match.Groups[1].ToString(); string lineVal = match.Groups[2].ToString(); int lineNumber; if (int.TryParse(lineVal, out lineNumber)) { element = new SourcePathEntry(path, lineNumber); return true; } } element = SourcePathEntry.Invalid; return false; }
public static bool TryParseCompilerMessage(string line, out SourcePathEntry entry) { if (line != null) { Match m = PatternCompilerMessageSourcePath.Match(line); if (m.Success) { string path = m.Groups[1].Value; int lineNumber = StringUtils.ParseInt(m.Groups[2].Value, -1); entry = new SourcePathEntry(path, lineNumber); return true; } } entry = SourcePathEntry.Invalid; return false; }