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

Unified Diff: pkg/docgen/test/util.dart

Issue 203753005: pkg/docgen: test fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/docgen/test/typedef_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/test/util.dart
diff --git a/pkg/docgen/test/util.dart b/pkg/docgen/test/util.dart
index fad786d4417ca5ce73cf0120eb60b2788c4aa12c..3f7f2ed8f08c3e9c42de02252989c539850892a1 100644
--- a/pkg/docgen/test/util.dart
+++ b/pkg/docgen/test/util.dart
@@ -1,5 +1,31 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library docgen.test.util;
+
+import 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as p;
+import 'package:scheduled_test/descriptor.dart' as d;
+import 'package:scheduled_test/scheduled_test.dart';
+
+void scheduleTempDir() {
+ var tempDir;
+ schedule(() {
+ return Directory.systemTemp
+ .createTemp('docgen_test-')
+ .then((dir) {
+ tempDir = dir;
+ d.defaultRoot = tempDir.path;
+ });
+ });
+
+ currentSchedule.onComplete.schedule(() {
+ d.defaultRoot = null;
+ return tempDir.delete(recursive: true);
+ });
+}
String getMultiLibraryCodePath() {
var currentScript = p.fromUri(Platform.script);
@@ -9,3 +35,20 @@ String getMultiLibraryCodePath() {
return codeDir;
}
+
+final Matcher hasSortedLines = predicate((String input) {
+ var lines = new LineSplitter().convert(input);
+
+ var sortedLines = new List.from(lines)..sort();
+
+ var orderedMatcher = orderedEquals(sortedLines);
+ return orderedMatcher.matches(lines, {});
+}, 'String has sorted lines');
+
+final Matcher isJsonMap = predicate((input) {
+ try {
+ return JSON.decode(input) is Map;
+ } catch (e) {
+ return false;
+ }
+}, 'Output is JSON encoded Map');
« no previous file with comments | « pkg/docgen/test/typedef_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698