| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 @TestOn("vm") | 5 @TestOn("vm") |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
| 10 import 'package:test/src/util/io.dart'; | 10 import 'package:test/src/util/io.dart'; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 expect(result.exitCode, equals(0)); | 132 expect(result.exitCode, equals(0)); |
| 133 }); | 133 }); |
| 134 | 134 |
| 135 test("on Dartium", () { | 135 test("on Dartium", () { |
| 136 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 136 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
| 137 var result = _runUnittest(["-p", "dartium", "test.dart"]); | 137 var result = _runUnittest(["-p", "dartium", "test.dart"]); |
| 138 expect(result.stdout, isNot(contains("Compiling"))); | 138 expect(result.stdout, isNot(contains("Compiling"))); |
| 139 expect(result.exitCode, equals(0)); | 139 expect(result.exitCode, equals(0)); |
| 140 }); | 140 }); |
| 141 | 141 |
| 142 test("on content shell", () { |
| 143 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
| 144 var result = _runUnittest(["-p", "content-shell", "test.dart"]); |
| 145 expect(result.stdout, isNot(contains("Compiling"))); |
| 146 expect(result.exitCode, equals(0)); |
| 147 }); |
| 148 |
| 142 test("on multiple browsers", () { | 149 test("on multiple browsers", () { |
| 143 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 150 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
| 144 var result = _runUnittest(["-p", "firefox", "-p", "chrome", "test.dart"]); | 151 var result = _runUnittest(["-p", "firefox", "-p", "chrome", "test.dart"]); |
| 145 expect("Compiling".allMatches(result.stdout), hasLength(1)); | 152 expect("Compiling".allMatches(result.stdout), hasLength(1)); |
| 146 expect(result.exitCode, equals(0)); | 153 expect(result.exitCode, equals(0)); |
| 147 }); | 154 }); |
| 148 | 155 |
| 149 test("on a JS and non-JS browser", () { | 156 test("on a JS and non-JS browser", () { |
| 150 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 157 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
| 151 var result = _runUnittest(["-p", "dartium", "-p", "chrome", "test.dart"]); | 158 var result = _runUnittest( |
| 159 ["-p", "content-shell", "-p", "chrome", "test.dart"]); |
| 152 expect("Compiling".allMatches(result.stdout), hasLength(1)); | 160 expect("Compiling".allMatches(result.stdout), hasLength(1)); |
| 153 expect(result.exitCode, equals(0)); | 161 expect(result.exitCode, equals(0)); |
| 154 }); | 162 }); |
| 155 | 163 |
| 156 test("on the browser and the VM", () { | 164 test("on the browser and the VM", () { |
| 157 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); | 165 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success); |
| 158 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); | 166 var result = _runUnittest(["-p", "chrome", "-p", "vm", "test.dart"]); |
| 159 expect(result.exitCode, equals(0)); | 167 expect(result.exitCode, equals(0)); |
| 160 }); | 168 }); |
| 161 }); | 169 }); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 172 var result = _runUnittest(["-p", "firefox", "test.dart"]); | 180 var result = _runUnittest(["-p", "firefox", "test.dart"]); |
| 173 expect(result.exitCode, equals(1)); | 181 expect(result.exitCode, equals(1)); |
| 174 }); | 182 }); |
| 175 | 183 |
| 176 test("on Dartium", () { | 184 test("on Dartium", () { |
| 177 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); | 185 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
| 178 var result = _runUnittest(["-p", "dartium", "test.dart"]); | 186 var result = _runUnittest(["-p", "dartium", "test.dart"]); |
| 179 expect(result.exitCode, equals(1)); | 187 expect(result.exitCode, equals(1)); |
| 180 }); | 188 }); |
| 181 | 189 |
| 190 test("on content-shell", () { |
| 191 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |
| 192 var result = _runUnittest(["-p", "content-shell", "test.dart"]); |
| 193 expect(result.exitCode, equals(1)); |
| 194 }); |
| 195 |
| 182 test("that fail only on the browser", () { | 196 test("that fail only on the browser", () { |
| 183 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" | 197 new File(p.join(_sandbox, "test.dart")).writeAsStringSync(""" |
| 184 import 'dart:async'; | 198 import 'dart:async'; |
| 185 | 199 |
| 186 import 'package:path/path.dart' as p; | 200 import 'package:path/path.dart' as p; |
| 187 import 'package:test/test.dart'; | 201 import 'package:test/test.dart'; |
| 188 | 202 |
| 189 void main() { | 203 void main() { |
| 190 test("test", () { | 204 test("test", () { |
| 191 if (p.style == p.Style.url) throw new TestFailure("oh no"); | 205 if (p.style == p.Style.url) throw new TestFailure("oh no"); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 """); | 243 """); |
| 230 | 244 |
| 231 var result = _runUnittest(["-p", "chrome", "test.dart"]); | 245 var result = _runUnittest(["-p", "chrome", "test.dart"]); |
| 232 expect(result.stdout, contains("Hello,\nworld!\n")); | 246 expect(result.stdout, contains("Hello,\nworld!\n")); |
| 233 expect(result.exitCode, equals(0)); | 247 expect(result.exitCode, equals(0)); |
| 234 }); | 248 }); |
| 235 } | 249 } |
| 236 | 250 |
| 237 ProcessResult _runUnittest(List<String> args) => | 251 ProcessResult _runUnittest(List<String> args) => |
| 238 runUnittest(args, workingDirectory: _sandbox); | 252 runUnittest(args, workingDirectory: _sandbox); |
| OLD | NEW |