| 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/test.dart'; | 10 import 'package:test/test.dart'; |
| 11 import 'package:test/src/backend/platform_selector.dart'; | 11 import 'package:test/src/backend/platform_selector.dart'; |
| 12 import 'package:test/src/backend/test_platform.dart'; | 12 import 'package:test/src/backend/test_platform.dart'; |
| 13 import 'package:test/src/runner/parse_metadata.dart'; | 13 import 'package:test/src/runner/parse_metadata.dart'; |
| 14 import 'package:test/src/util/io.dart'; |
| 14 | 15 |
| 15 String _sandbox; | 16 String _sandbox; |
| 16 String _path; | 17 String _path; |
| 17 | 18 |
| 18 void main() { | 19 void main() { |
| 19 setUp(() { | 20 setUp(() { |
| 20 _sandbox = Directory.systemTemp.createTempSync('test_').path; | 21 _sandbox = createTempDir(); |
| 21 _path = p.join(_sandbox, "test.dart"); | 22 _path = p.join(_sandbox, "test.dart"); |
| 22 }); | 23 }); |
| 23 | 24 |
| 24 tearDown(() { | 25 tearDown(() { |
| 25 new Directory(_sandbox).deleteSync(recursive: true); | 26 new Directory(_sandbox).deleteSync(recursive: true); |
| 26 }); | 27 }); |
| 27 | 28 |
| 28 test("returns empty metadata for an empty file", () { | 29 test("returns empty metadata for an empty file", () { |
| 29 new File(_path).writeAsStringSync(""); | 30 new File(_path).writeAsStringSync(""); |
| 30 var metadata = parseMetadata(_path); | 31 var metadata = parseMetadata(_path); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 expect(() => parseMetadata(_path), throwsFormatException); | 92 expect(() => parseMetadata(_path), throwsFormatException); |
| 92 }); | 93 }); |
| 93 | 94 |
| 94 test("multiple @TestOns", () { | 95 test("multiple @TestOns", () { |
| 95 new File(_path).writeAsStringSync( | 96 new File(_path).writeAsStringSync( |
| 96 "@TestOn('foo')\n@TestOn('bar')\nlibrary foo;"); | 97 "@TestOn('foo')\n@TestOn('bar')\nlibrary foo;"); |
| 97 expect(() => parseMetadata(_path), throwsFormatException); | 98 expect(() => parseMetadata(_path), throwsFormatException); |
| 98 }); | 99 }); |
| 99 }); | 100 }); |
| 100 } | 101 } |
| OLD | NEW |