Mercurial > projects > dang
diff tests/run.d @ 1:2168f4cb73f1
First push
author | johnsen@johnsen-desktop |
---|---|
date | Fri, 18 Apr 2008 02:01:38 +0200 |
parents | |
children | 59bfbaf8847f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/run.d Fri Apr 18 02:01:38 2008 +0200 @@ -0,0 +1,69 @@ +module run.d; + +import tango.io.Stdout, + tango.io.FilePath, + tango.sys.Process; + + +char[] prog = "./Dang"; + +void main(char[][] args) +{ + auto cPath = FilePath("tests"); + + int succes, failure; + + foreach( path ; cPath.toList((FilePath path, bool isFolder){return isFolder;})) + { + Stdout(path.name)(":").newline; + foreach( p ; path.toList((FilePath path, bool isFolder) + { + if(path.ext == "d" && path.name[0] != '.') + return true; + return false; + })) + { + auto test = new Test(p); + bool result = test.run(); + if(result) + succes++; + else + failure++; + } + } + + Stdout().newline.newline() + ("Result:").newline() + (" - Succes: ")(succes).newline() + (" - Failure: ")(failure).newline; +} + +class Test +{ + FilePath target; + public this(FilePath target) + { + this.target = target; + } + + public bool run() + { + auto process = new Process(prog,target.path~target.file); + + Stdout(" - ")(target.file)(".. "); + + process.execute; + + auto result = process.wait; + if(result.status == 0) + { + Stdout("SUCCES").newline; + return true; + } + else + { + Stdout("FAILURE").newline; + return false; + } + } +}