Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: pkg/intl/test/message_extraction/message_extraction_test.dart

Issue 23446002: Remove hack for finding package-root in tests, now available in Platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
11 import '../data_directory.dart'; 11 import '../data_directory.dart';
12 12
13 final dart = Platform.executable; 13 final dart = Platform.executable;
14 14
15 // TODO(alanknight): We have no way of knowing what the package-root is, 15 /** The VM arguments we were given, most important package-root. */
16 // so when we're running under the test framework, which sets the 16 final vmArgs = Platform.executableArguments;
17 // package-root, we use a horrible hack and infer it from the executable.
18 final packageDir = _findPackageDir(dart);
19
20 /**
21 * Find our package directory from the executable. If we seem to be running
22 * from out/Release<arch>/dart or the equivalent Debug, then use the packages
23 * directory under Release<arch>. Otherwise return null, indicating to use
24 * the normal pub packages directory.
25 */
26 String _findPackageDir(executable) {
27 var oneUp = path.dirname(executable);
28 var tail = path.basename(oneUp);
29 // If we're running from test.dart, we want e.g. out/ReleaseIA32/packages
30 if (tail.contains('Release') || tail.contains('Debug')) {
31 return path.join(oneUp, 'packages/');
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 }
40 // Otherwise we will rely on the normal packages directory.
41 return null;
42 }
43
44 /** If our package root directory is set, return it as a VM argument. */
45 final vmArgs = (packageDir == null) ? [] : ['--package-root=$packageDir'];
46 17
47 /** 18 /**
48 * Translate a file path into this test directory, regardless of the 19 * Translate a file path into this test directory, regardless of the
49 * working directory. 20 * working directory.
50 */ 21 */
51 String dir([String s]) { 22 String dir([String s]) {
52 if (s != null && s.startsWith("--")) { // Don't touch command-line options. 23 if (s != null && s.startsWith("--")) { // Don't touch command-line options.
53 return s; 24 return s;
54 } else { 25 } else {
55 return path.join(intlDirectory, 'test', 'message_extraction', s); 26 return path.join(intlDirectory, 'test', 'message_extraction', s);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 verify('Null'); 240 verify('Null');
270 verify('ein'); 241 verify('ein');
271 verify('Mann'); 242 verify('Mann');
272 verify('Frau'); 243 verify('Frau');
273 verify('7 Mann'); 244 verify('7 Mann');
274 verify('7 Kanadischen dollar'); 245 verify('7 Kanadischen dollar');
275 verify('5 einige Währung oder anderen.'); 246 verify('5 einige Währung oder anderen.');
276 verify('1 Kanadischer dollar'); 247 verify('1 Kanadischer dollar');
277 verify('2 Kanadischen dollar'); 248 verify('2 Kanadischen dollar');
278 } 249 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698