Migrate tests to pkg/test.
This is a port of 786d4a020b851ecf58bd3c978c01824034aea7eb to the 0.1.x
branch.
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//1219653003.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0fee13..b620ac3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 0.1.8+1
+
+* Use the new `test` package runner internally.
+
# 0.1.8
* Update to latest `analyzer` and `args` packages.
diff --git a/pubspec.lock b/pubspec.lock
index 7c2ef77..5fd256c 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -4,11 +4,19 @@
analyzer:
description: analyzer
source: hosted
- version: "0.25.0"
+ version: "0.25.0+1"
args:
description: args
source: hosted
- version: "0.13.0"
+ version: "0.13.2"
+ async:
+ description: async
+ source: hosted
+ version: "1.2.0"
+ barback:
+ description: barback
+ source: hosted
+ version: "0.15.2+4"
browser:
description: browser
source: hosted
@@ -16,11 +24,15 @@
collection:
description: collection
source: hosted
- version: "1.1.0"
+ version: "1.1.1"
crypto:
description: crypto
source: hosted
version: "0.9.0"
+ glob:
+ description: glob
+ source: hosted
+ version: "1.0.4"
http:
description: http
source: hosted
@@ -32,23 +44,51 @@
http_parser:
description: http_parser
source: hosted
- version: "0.0.2+6"
+ version: "0.0.2+7"
matcher:
description: matcher
source: hosted
- version: "0.11.4+4"
+ version: "0.12.0+1"
+ mime:
+ description: mime
+ source: hosted
+ version: "0.9.3"
path:
description: path
source: hosted
version: "1.3.5"
+ pool:
+ description: pool
+ source: hosted
+ version: "1.1.0"
+ pub_semver:
+ description: pub_semver
+ source: hosted
+ version: "1.2.1"
scheduled_test:
description: scheduled_test
source: hosted
- version: "0.11.8"
+ version: "0.12.1+2"
shelf:
description: shelf
source: hosted
- version: "0.6.1+1"
+ version: "0.6.1+2"
+ shelf_static:
+ description: shelf_static
+ source: hosted
+ version: "0.2.2"
+ shelf_web_socket:
+ description: shelf_web_socket
+ source: hosted
+ version: "0.0.1+2"
+ source_map_stack_trace:
+ description: source_map_stack_trace
+ source: hosted
+ version: "1.0.4"
+ source_maps:
+ description: source_maps
+ source: hosted
+ version: "0.10.1"
source_span:
description: source_span
source: hosted
@@ -56,16 +96,20 @@
stack_trace:
description: stack_trace
source: hosted
- version: "1.3.1"
+ version: "1.3.4"
string_scanner:
description: string_scanner
source: hosted
version: "0.1.3+1"
- unittest:
- description: unittest
+ test:
+ description: test
source: hosted
- version: "0.11.5+4"
+ version: "0.12.3+4"
watcher:
description: watcher
source: hosted
- version: "0.9.5"
+ version: "0.9.6"
+ yaml:
+ description: yaml
+ source: hosted
+ version: "2.1.3"
diff --git a/pubspec.yaml b/pubspec.yaml
index 9f81841..ae66087 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: dart_style
-version: 0.1.8
+version: 0.1.8+1
author: Dart Team <misc@dartlang.org>
description: Opinionated, automatic Dart source code formatter.
homepage: https://github.com/dart-lang/dart_style
@@ -10,8 +10,8 @@
source_span: '>=1.0.0 <2.0.0'
dev_dependencies:
browser: '>=0.10.0 <0.11.0'
- scheduled_test: '>=0.11.2 <0.12.0'
- unittest: '>=0.11.0 <0.12.0'
+ scheduled_test: '>=0.12.0 <0.13.0'
+ test: '>=0.12.0 <0.13.0'
executables:
dartfmt: format
dartformat: format # Allow the old name for compatibility.
diff --git a/test/formatter_test.dart b/test/formatter_test.dart
index 5f4ea11..050cab2 100644
--- a/test/formatter_test.dart
+++ b/test/formatter_test.dart
@@ -5,19 +5,14 @@
library dart_style.test.formatter_test;
import 'dart:io';
+import 'dart:mirrors';
import 'package:path/path.dart' as p;
-import 'package:unittest/compact_vm_config.dart';
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
import 'package:dart_style/dart_style.dart';
void main() {
- // Tidy up the unittest output.
- filterStacks = true;
- formatStacks = true;
- useCompactVMConfiguration();
-
testDirectory("comments");
testDirectory("regression");
testDirectory("selections");
@@ -113,8 +108,16 @@
void testDirectory(String name) {
var indentPattern = new RegExp(r"^\(indent (\d+)\)\s*");
- var dir = p.join(p.dirname(p.fromUri(Platform.script)), name);
- for (var entry in new Directory(dir).listSync()) {
+ // Locate the "test" directory. Use mirrors so that this works with the test
+ // package, which loads this suite into an isolate.
+ var testDir = p.dirname(currentMirrorSystem()
+ .findLibrary(#dart_style.test.formatter_test)
+ .uri
+ .path);
+
+ var entries = new Directory(p.join(testDir, name))
+ .listSync(recursive: true, followLinks: false);
+ for (var entry in entries) {
if (!entry.path.endsWith(".stmt") && !entry.path.endsWith(".unit")) {
continue;
}
diff --git a/test/source_code_test.dart b/test/source_code_test.dart
index ed146a1..2361ca7 100644
--- a/test/source_code_test.dart
+++ b/test/source_code_test.dart
@@ -4,7 +4,7 @@
library dart_style.test.source_code_test;
-import 'package:unittest/unittest.dart';
+import 'package:test/test.dart';
import 'package:dart_style/dart_style.dart';
diff --git a/test/utils.dart b/test/utils.dart
index 8fba63d..2c555d0 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -10,7 +10,6 @@
import 'package:scheduled_test/descriptor.dart' as d;
import 'package:scheduled_test/scheduled_process.dart';
import 'package:scheduled_test/scheduled_test.dart';
-import 'package:unittest/compact_vm_config.dart';
const unformattedSource = 'void main() => print("hello") ;';
const formattedSource = 'void main() => print("hello");\n';
@@ -19,8 +18,7 @@
ScheduledProcess runFormatter([List<String> args]) {
if (args == null) args = [];
- var formatterPath = p.join(
- p.dirname(p.fromUri(Platform.script)), "..", "bin", "format.dart");
+ var formatterPath = p.join("bin", "format.dart");
args.insert(0, formatterPath);
@@ -44,11 +42,6 @@
/// Configures the unit test output and makes a sandbox directory for the
/// scheduled tests to run in.
void setUpTestSuite() {
- // Tidy up the unittest output.
- filterStacks = true;
- formatStacks = true;
- useCompactVMConfiguration();
-
// Make a sandbox directory for the scheduled tests to run in.
setUp(() {
var tempDir = Directory.systemTemp.createTempSync('dart_style.test.');