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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/test/typedef_test.dart ('k') | pkg/pkg.status » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 library docgen.test.util;
6
7 import 'dart:convert';
1 import 'dart:io'; 8 import 'dart:io';
2 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:scheduled_test/descriptor.dart' as d;
11 import 'package:scheduled_test/scheduled_test.dart';
12
13 void scheduleTempDir() {
14 var tempDir;
15 schedule(() {
16 return Directory.systemTemp
17 .createTemp('docgen_test-')
18 .then((dir) {
19 tempDir = dir;
20 d.defaultRoot = tempDir.path;
21 });
22 });
23
24 currentSchedule.onComplete.schedule(() {
25 d.defaultRoot = null;
26 return tempDir.delete(recursive: true);
27 });
28 }
3 29
4 String getMultiLibraryCodePath() { 30 String getMultiLibraryCodePath() {
5 var currentScript = p.fromUri(Platform.script); 31 var currentScript = p.fromUri(Platform.script);
6 var codeDir = p.join(p.dirname(currentScript), 'multi_library_code'); 32 var codeDir = p.join(p.dirname(currentScript), 'multi_library_code');
7 33
8 assert(FileSystemEntity.isDirectorySync(codeDir)); 34 assert(FileSystemEntity.isDirectorySync(codeDir));
9 35
10 return codeDir; 36 return codeDir;
11 } 37 }
38
39 final Matcher hasSortedLines = predicate((String input) {
40 var lines = new LineSplitter().convert(input);
41
42 var sortedLines = new List.from(lines)..sort();
43
44 var orderedMatcher = orderedEquals(sortedLines);
45 return orderedMatcher.matches(lines, {});
46 }, 'String has sorted lines');
47
48 final Matcher isJsonMap = predicate((input) {
49 try {
50 return JSON.decode(input) is Map;
51 } catch (e) {
52 return false;
53 }
54 }, 'Output is JSON encoded Map');
OLDNEW
« 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