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

Side by Side Diff: tests/standalone/io/platform_test.dart

Issue 953323002: Fix broken test of platform version (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import "dart:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 8
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Patch version. 79 // Patch version.
80 Expect.isTrue(int.parse(match.group(3)) >= 0); 80 Expect.isTrue(int.parse(match.group(3)) >= 0);
81 // Dev 81 // Dev
82 if (match.group(4) != null) { 82 if (match.group(4) != null) {
83 // Dev prerelease minor version 83 // Dev prerelease minor version
84 Expect.isTrue(int.parse(match.group(5)) >= 0); 84 Expect.isTrue(int.parse(match.group(5)) >= 0);
85 // Dev prerelease patch version 85 // Dev prerelease patch version
86 Expect.isTrue(int.parse(match.group(6)) >= 0); 86 Expect.isTrue(int.parse(match.group(6)) >= 0);
87 } 87 }
88 } 88 }
89
90 String stripAdditionalInfo(String version) {
91 var index = version.indexOf(' ');
92 if (index == -1) return version;
93 return version.substring(0, index);
94 }
95
89 // Ensure we can match valid versions. 96 // Ensure we can match valid versions.
90 checkValidVersion('1.9.0'); 97 checkValidVersion('1.9.0');
91 checkValidVersion('1.9.0-dev.0.0'); 98 checkValidVersion('1.9.0-dev.0.0');
92 checkValidVersion('1.9.0-edge'); 99 checkValidVersion('1.9.0-edge');
93 checkValidVersion('1.9.0-edge.r41234'); 100 checkValidVersion('1.9.0-edge.r41234');
101 // Check stripping of additional information.
102 checkValidVersion(stripAdditionalInfo(
103 '1.9.0-dev.1.2 (Wed Feb 25 02:22:19 2015) on "linux_ia32"'));
94 // Test current version. 104 // Test current version.
95 checkValidVersion(Platform.version); 105 checkValidVersion(stripAdditionalInfo(Platform.version));
96 // Test some invalid versions. 106 // Test some invalid versions.
97 Expect.throws(() => checkValidVersion('1.9')); 107 Expect.throws(() => checkValidVersion('1.9'));
98 Expect.throws(() => checkValidVersion('2.0.0')); 108 Expect.throws(() => checkValidVersion('2.0.0'));
99 Expect.throws(() => checkValidVersion('..')); 109 Expect.throws(() => checkValidVersion('..'));
100 Expect.throws(() => checkValidVersion('1..')); 110 Expect.throws(() => checkValidVersion('1..'));
101 Expect.throws(() => checkValidVersion('1.9.')); 111 Expect.throws(() => checkValidVersion('1.9.'));
102 Expect.throws(() => checkValidVersion('1.9.0-dev..')); 112 Expect.throws(() => checkValidVersion('1.9.0-dev..'));
103 Expect.throws(() => checkValidVersion('1.9.0-dev..0')); 113 Expect.throws(() => checkValidVersion('1.9.0-dev..0'));
104 Expect.throws(() => checkValidVersion('1.9.0-dev.0.')); 114 Expect.throws(() => checkValidVersion('1.9.0-dev.0.'));
105 Expect.throws(() => checkValidVersion('1.9.0-dev.x.y')); 115 Expect.throws(() => checkValidVersion('1.9.0-dev.x.y'));
106 Expect.throws(() => checkValidVersion('x')); 116 Expect.throws(() => checkValidVersion('x'));
107 Expect.throws(() => checkValidVersion('x.y.z')); 117 Expect.throws(() => checkValidVersion('x.y.z'));
108 } 118 }
109 119
110 main() { 120 main() {
111 // This tests assumes paths relative to dart main directory 121 // This tests assumes paths relative to dart main directory
112 Directory.current = Platform.script.resolve('../../..').toFilePath(); 122 Directory.current = Platform.script.resolve('../../..').toFilePath();
113 test(); 123 test();
114 testIsolate(); 124 testIsolate();
115 testVersion(); 125 testVersion();
116 } 126 }
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