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

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

Issue 184693004: pkg/docgen: sort items in index.txt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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/lib/docgen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/test/generate_json_test.dart
diff --git a/pkg/docgen/test/generate_json_test.dart b/pkg/docgen/test/generate_json_test.dart
index 3e1615f86c6ac3f61536c51b37499eb3684b3d9d..522758caef1ac14030272a2eed73431f5f9bdb92 100644
--- a/pkg/docgen/test/generate_json_test.dart
+++ b/pkg/docgen/test/generate_json_test.dart
@@ -36,7 +36,7 @@ void main() {
d.dir('docs', [
d.matcherFile('index.json', _isJsonMap),
- d.matcherFile('index.txt', isNotNull),
+ d.matcherFile('index.txt', _hasSortedLines),
d.matcherFile('library_list.json', _isJsonMap),
d.matcherFile('testLib-bar.C.json', _isJsonMap),
d.matcherFile('testLib-bar.json', _isJsonMap),
@@ -47,9 +47,19 @@ void main() {
d.matcherFile('testLib2-foo.B.json', _isJsonMap),
d.matcherFile('testLib2-foo.json', _isJsonMap)
]).validate();
+
});
}
+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;
« no previous file with comments | « pkg/docgen/lib/docgen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698