public override void WriteComment(int nr, OrderedDictionary dic, List <PathEntry> path, string name) { WriteBaseComment(nr, dic); var ext = (OrderedDictionary)dic["extensions"]; if (ext != null) { if (ext.Contains("cmp")) { WriteCmpComment(dic, (string)ext["cmp"]); } } else if (dic.Contains("actual")) { WriteIsComment(dic, path); } var msg = (string)dic["message"]; if (msg != null) { Tw.WriteLine("# " + msg); } var backtrace = (string)dic["backtrace"]; if (backtrace != null) { string estring = Regex.Replace(backtrace, @"^", "# ", RegexOptions.Multiline); Tw.WriteLine(estring); } }
void WriteBaseComment(int nr, OrderedDictionary dic) { Tw.Write("# failed test {0} (", nr); var filename = (string)dic["file"]; if (filename != null) { Tw.Write("{0} at pos {1} ", filename, MkCoords(dic)); } Tw.WriteLine("in {0})", dic["method"]); }
void WriteIsVal(bool leaf, OrderedDictionary dic, string label, string key, List <PathEntry> path, int side) { var val = dic[key]; if (leaf) { Tw.Write("{0}: '{1}'", label, SafeToString(val)); } else { Tw.WriteLine(" {0}:", label); var yw = new YAMLWriter(Tw, 4, TAP.HorizontalThreshold, BBD); yw.Annotate = (i, n) => { return(GetAnnotation(i, n, path, side, 0)); }; yw.Write(val); } }
void WriteIsComment(OrderedDictionary dic, List <PathEntry> path) { bool leaf = path == null || (YAMLWriter.IsLeafType(dic["actual"]) && YAMLWriter.IsLeafType(dic["expected"])); if (!leaf) { Tw.WriteLine("actual not as expected"); } WriteIsVal(leaf, dic, "got", "actual", path, 0); if (leaf) { Tw.Write(" "); } WriteIsVal(leaf, dic, "expected", "expected", path, 1); if (leaf) { Tw.WriteLine(); } }
void WriteCmpComment(OrderedDictionary dic, string cmp) { Tw.WriteLine("'{0}' {1} '{2}'", ValOrNull(dic, "actual"), cmp, ValOrNull(dic, "expected")); }