Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library message_extraction_test; | 5 library message_extraction_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * directory under Release<arch>. Otherwise return null, indicating to use | 23 * directory under Release<arch>. Otherwise return null, indicating to use |
| 24 * the normal pub packages directory. | 24 * the normal pub packages directory. |
| 25 */ | 25 */ |
| 26 String _findPackageDir(executable) { | 26 String _findPackageDir(executable) { |
| 27 var oneUp = path.dirname(executable); | 27 var oneUp = path.dirname(executable); |
| 28 var tail = path.basename(oneUp); | 28 var tail = path.basename(oneUp); |
| 29 // If we're running from test.dart, we want e.g. out/ReleaseIA32/packages | 29 // If we're running from test.dart, we want e.g. out/ReleaseIA32/packages |
| 30 if (tail.contains('Release') || tail.contains('Debug')) { | 30 if (tail.contains('Release') || tail.contains('Debug')) { |
| 31 return path.join(oneUp, 'packages/'); | 31 return path.join(oneUp, 'packages/'); |
| 32 } | 32 } |
| 33 // Check for the case where we're running Release<arch>/dart-sdk/bin/dart | |
| 34 // (pub bots) | |
| 35 var threeUp = path.dirname(path.dirname(oneUp)); | |
| 36 tail = path.basename(threeUp); | |
| 37 if (tail.contains('Release') || tail.contains('Debug')) { | |
| 38 return path.join(threeUp, 'packages/'); | |
| 39 } | |
| 33 // Otherwise we will rely on the normal packages directory. | 40 // Otherwise we will rely on the normal packages directory. |
| 34 return null; | 41 return null; |
| 35 } | 42 } |
| 36 | 43 |
| 37 /** If our package root directory is set, return it as a VM argument. */ | 44 /** If our package root directory is set, return it as a VM argument. */ |
| 38 final vmArgs = (packageDir == null) ? [] : ['--package-root=$packageDir']; | 45 final vmArgs = (packageDir == null) ? [] : ['--package-root=$packageDir']; |
| 39 | 46 |
| 40 /** | 47 /** |
| 41 * Translate a file path into this test directory, regardless of the | 48 * Translate a file path into this test directory, regardless of the |
| 42 * working directory. | 49 * working directory. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 void verifyResult(results) { | 124 void verifyResult(results) { |
| 118 var lineIterator; | 125 var lineIterator; |
| 119 verify(String s) { | 126 verify(String s) { |
| 120 lineIterator.moveNext(); | 127 lineIterator.moveNext(); |
| 121 var value = lineIterator.current; | 128 var value = lineIterator.current; |
| 122 expect(value, s); | 129 expect(value, s); |
| 123 } | 130 } |
| 124 | 131 |
| 125 var output = results.stdout; | 132 var output = results.stdout; |
| 126 var lines = output.split("\n"); | 133 var lines = output.split("\n"); |
| 134 // If it looks like these are CRLF delimited, then use that. Wish strings | |
| 135 // just implemented last. | |
|
Emily Fortuna
2013/03/14 21:45:50
can we file a bug on this? :-)
| |
| 136 if (lines.first.codeUnits.last == "\r".codeUnits.first) { | |
| 137 lines = output.split("\r\n"); | |
| 138 } | |
| 127 lineIterator = lines.iterator..moveNext(); | 139 lineIterator = lines.iterator..moveNext(); |
| 128 verify("Printing messages for en_US"); | 140 verify("Printing messages for en_US"); |
| 129 verify("This is a message"); | 141 verify("This is a message"); |
| 130 verify("Another message with parameter hello"); | 142 verify("Another message with parameter hello"); |
| 131 verify("Characters that need escaping, e.g slashes \\ dollars \${ " | 143 verify("Characters that need escaping, e.g slashes \\ dollars \${ " |
| 132 "(curly braces are ok) and xml reserved characters <& and " | 144 "(curly braces are ok) and xml reserved characters <& and " |
| 133 "quotes \" parameters 1, 2, and 3"); | 145 "quotes \" parameters 1, 2, and 3"); |
| 134 verify("This string extends across multiple lines."); | 146 verify("This string extends across multiple lines."); |
| 135 verify("1, b, [c, d]"); | 147 verify("1, b, [c, d]"); |
| 136 verify('"So-called"'); | 148 verify('"So-called"'); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 verify("Diese Methode ist nicht eine Lambda"); | 210 verify("Diese Methode ist nicht eine Lambda"); |
| 199 verify("Dies ergibt sich aus einer statischen Methode"); | 211 verify("Dies ergibt sich aus einer statischen Methode"); |
| 200 verify("This is missing some translations"); | 212 verify("This is missing some translations"); |
| 201 verify("Antike griechische Galgenmännchen Zeichen: 𐅆𐅇"); | 213 verify("Antike griechische Galgenmännchen Zeichen: 𐅆𐅇"); |
| 202 // verify("Die Sache ist, well"); | 214 // verify("Die Sache ist, well"); |
| 203 // expect("Einer der knifflige Dinge ist der Plural"); | 215 // expect("Einer der knifflige Dinge ist der Plural"); |
| 204 // expect("Zu den kniffligen Dinge Pluralformen"); | 216 // expect("Zu den kniffligen Dinge Pluralformen"); |
| 205 verify("Escapes: "); | 217 verify("Escapes: "); |
| 206 verify("\r\f\b\t\v."); | 218 verify("\r\f\b\t\v."); |
| 207 } | 219 } |
| OLD | NEW |