Mercurial > projects > dang
comparison tests/run.d @ 186:e1e170c2cd44
Fixed a error in the test program.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Fri, 25 Jul 2008 12:50:09 +0200 |
parents | 0ea5d2f3e96b |
children | fda35d57847e |
comparison
equal
deleted
inserted
replaced
185:7b274cfdc1dc | 186:e1e170c2cd44 |
---|---|
99 bool compile = true; | 99 bool compile = true; |
100 int fail = NoFail; | 100 int fail = NoFail; |
101 if (line.length >= 2 && line[0 .. 2] == "//") | 101 if (line.length >= 2 && line[0 .. 2] == "//") |
102 { | 102 { |
103 foreach (command; line[2 .. $].delimiters(",;")) | 103 foreach (command; line[2 .. $].delimiters(",;")) |
104 { | |
104 switch (toLower(substitute(command, " ", ""))) | 105 switch (toLower(substitute(command, " ", ""))) |
105 { | 106 { |
106 case "skip", "dontcompile": | 107 case "skip", "dontcompile": |
107 compile = false; | 108 compile = false; |
108 break; | 109 break; |
115 Stderr("== Compiled tests will not be run! ==").newline; | 116 Stderr("== Compiled tests will not be run! ==").newline; |
116 return TestResult.Skipped; | 117 return TestResult.Skipped; |
117 default: | 118 default: |
118 break; | 119 break; |
119 } | 120 } |
121 break; | |
122 } | |
120 } | 123 } |
121 | 124 |
122 if (compile) | 125 if (compile) |
123 { | 126 { |
124 auto process = new Process(compiler, "--gen-llvm", p.toString()); | 127 auto process = new Process(compiler, "--gen-llvm", p.toString()); |
147 return "\033[1;31m" ~ s ~ "\033[m"; | 150 return "\033[1;31m" ~ s ~ "\033[m"; |
148 else | 151 else |
149 return s; | 152 return s; |
150 } | 153 } |
151 | 154 |
152 bool unexpected = (result != expected); | 155 bool unexpected = expected == 0 ? result != 0 : result == 0; |
153 auto f = unexpected? &bad : &good; | 156 auto f = unexpected? &bad : &good; |
154 char[] s = (result == 0)? "SUCCESS" : "FAILURE"; | 157 char[] s = (result == 0)? "SUCCESS" : "FAILURE"; |
155 // always print if unexpeted, otherwise check the settings | 158 // always print if unexpeted, otherwise check the settings |
156 if (unexpected || print_expected) | 159 if (unexpected || print_expected) |
157 { | 160 { |