Chromium Code Reviews| Index: tools/testing/dart/multitest.dart |
| diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart |
| index ab4452137b523d86db5608a39861059c1cf7de63..6ab6288c90d6e6624c93d89c4a84d4b19679112f 100644 |
| --- a/tools/testing/dart/multitest.dart |
| +++ b/tools/testing/dart/multitest.dart |
| @@ -44,10 +44,16 @@ |
| // aaa |
| // ddd /// 07: static type error |
| // eee |
| +// |
| +// Note that it is possible to indicate more than one acceptable outcome |
| +// in the case of dynamic and static type errors |
| +// aaa |
| +// ddd /// 07: static type error, dynamic type error |
| +// eee |
| void ExtractTestsFromMultitest(String filename, |
| Map<String, String> tests, |
| - Map<String, String> outcomes) { |
| + Map<String, Set<String>> outcomes) { |
| // Read the entire file into a byte buffer and transform it to a |
| // String. This will treat the file as ascii but the only parts |
| // we are interested in will be ascii in any case. |
| @@ -89,10 +95,19 @@ void ExtractTestsFromMultitest(String filename, |
| Expect.equals('continued', rest); |
| testsAsLines[key].add(line); |
| } else { |
| + // TODO(zundel): parse a list here |
| (testsAsLines[key] = new List<String>.from(testTemplate)).add(line); |
| - outcomes[key] = rest; |
| - if (!validMultitestOutcomes.contains(rest)) { |
| - Expect.fail("Invalid test directive on line ${lineCount}: $rest "); |
| + List<String> outcomesList = rest.split(','); |
| + for (String nextOutcome in outcomesList) { |
| + nextOutcome = nextOutcome.trim(); |
| + if (outcomes[key] == null) { |
| + outcomes[key] = new Set<String>(); |
| + } |
| + outcomes[key].add(nextOutcome.trim()); |
|
Bill Hesse
2012/03/08 10:21:49
This can be replaced by:
outcomes.putIfAbsent(key,
zundel
2012/03/08 13:18:00
nice
|
| + if (!validMultitestOutcomes.contains(nextOutcome)) { |
| + Expect.fail( |
| + "Invalid test directive '$nextOutcome' on line ${lineCount}: $rest "); |
| + } |
| } |
| } |
| } else { |
| @@ -102,7 +117,7 @@ void ExtractTestsFromMultitest(String filename, |
| } |
| // Add the template, with no multitest lines, as a test with key 'none'. |
| testsAsLines['none'] = testTemplate; |
| - outcomes['none'] = ''; |
| + outcomes['none'] = new Set<String>(); |
|
Bill Hesse
2012/03/08 10:21:49
Either the no-error case is an empty set, or it is
zundel
2012/03/08 13:18:00
I'm going with the empty set.
|
| // Copy all the tests into the output map tests, as multiline strings. |
| for (String key in testsAsLines.getKeys()) { |
| @@ -165,7 +180,7 @@ void DoMultitest(String filename, |
| Function multitestDone) { |
| // Each new test is a single String value in the Map tests. |
| Map<String, String> tests = new Map<String, String>(); |
| - Map<String, String> outcomes = new Map<String, String>(); |
| + Map<String, Set<String>> outcomes = new Map<String, Set<String>>(); |
| ExtractTestsFromMultitest(filename, tests, outcomes); |
| String directory = CreateMultitestDirectory(outputDir, testDir); |
| @@ -197,7 +212,7 @@ void DoMultitest(String filename, |
| var bytes = tests[key].charCodes(); |
| openedFile.writeListSync(bytes, 0, bytes.length); |
| openedFile.closeSync(); |
| - var outcome = outcomes[key]; |
| + Set<String> outcome = outcomes[key]; |
| bool enableFatalTypeErrors = outcome.contains('static type error'); |
| bool hasRuntimeErrors = outcome.contains('runtime error'); |
| bool isNegative = hasRuntimeErrors |