コード例 #1
0
 public static int Main(string[] args)
 {
     try {
         ReadArgs(args);
         var tr = new TAPRunner();
         tr.CompileAndRun(tr.Expand(Paths));
         tr.ShowTotals();
         VLog(2, "EXIT {0}", tr.Exit);
         return(Zero?0:tr.Exit);
     } catch (Exception e) {
         ELog(e.ToString());
         return(1);
     }
 }
コード例 #2
0
ファイル: mismatch.cs プロジェクト: TestAnything/taps-testing
    static int Main() {
        Plan(4);
        var paths=new string[] {"t\\12many.cs.notcs","t\\12few.cs.notcs"};
        var sw=new StringWriter();
        sw.NewLine="\r\n";
        TAPApp.Out=sw;
        TAPApp.Subject="u";
        try {
            TAPRunner r=new TAPRunner();
            r.CompileAndRun(paths.Select(x=>new ScriptPath(TAPApp.FixPathSep(x),null)));
            var cs=TAPParser.Total;
            Is(cs.NPlanned,2);
            Is(cs.NOk,2);
            Is(cs.Mismatch,true);
            r.ShowTotals();
            Like(sw.ToString(),@"did not match number of tests\.
.*planned: 2 run: 2\b");
        } catch(Exception) {
            Dump("mismatch sw",sw);
            throw;
        }
        return 0;
    }
コード例 #3
0
 public static int Main(string[] args) {
     try {
         ReadArgs(args);
         var tr=new TAPRunner();
         tr.CompileAndRun(tr.Expand(Paths));
         tr.ShowTotals();
         VLog(2,"EXIT {0}",tr.Exit);
         return Zero?0:tr.Exit;
     } catch(Exception e) {
         ELog(e.ToString());
         return 1;
     }
 }
コード例 #4
0
ファイル: testtest.cs プロジェクト: TestAnything/taps-testing
 static Action MkMetatest(string expstr,string source) {
     source=TAPApp.FixPathSep(source);
     string[] expected=expstr.Split(new []{"\r\n"},StringSplitOptions.None).Select<string,string>(PreProc).Where(x=>x!=null).ToArray();
     NPlanned+=expected.Length;
     return ()=>{
         var sw=new StringWriter();
         TAPApp.Out=sw;
         TAPApp.Subject="u";
         try {
             TAPRunner r=new TAPRunner();
             Diag(source);
             r.CompileAndRun(new []{new ScriptPath(source,null)});
             var sr=new StringReader(sw.GetStringBuilder().ToString());
             int idx=0;
             do {
                 string s=sr.ReadLine();
                 if(s==null) break;
                 if(idx>=expected.Length) {
                     Diag("output has more lines than expected-arr: "+s);
                 } else {
                     Match m=ReRe.Match(expected[idx]);
                     if(m.Success) {
                         string re=m.Groups[1].Value;
                         Like(s,re);
                     } else {
                         Is(s,expected[idx]);
                     }
                 }
                 ++idx;
             } while(true);
         } catch(Exception) {
             Diag("sw contains "+Regex.Replace(sw.GetStringBuilder().ToString(),"^","#>> ",RegexOptions.Multiline));
             throw;
         }
     };
 }