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

Unified Diff: packages/petitparser/test/dart_file_tests.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/petitparser/test/core_benchmark.dart ('k') | packages/petitparser/test/dart_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/petitparser/test/dart_file_tests.dart
diff --git a/packages/petitparser/test/dart_file_tests.dart b/packages/petitparser/test/dart_file_tests.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d30c21ab725c577117c60aac4824811ed453c14f
--- /dev/null
+++ b/packages/petitparser/test/dart_file_tests.dart
@@ -0,0 +1,37 @@
+/// This test-case automatically generates various tests from Dart source
+/// code. Unfortunately the parser is currently unable to parse most of
+/// these files.
+library petitparser.test.dart_file_test;
+
+import 'dart:io';
+
+import 'package:test/test.dart';
+
+import 'package:petitparser/dart.dart';
+import 'package:petitparser/test.dart';
+
+void generateTests(DartGrammar dart, String title, List<FileSystemEntity> files) {
+ group(title, () {
+ files
+ .where((file) => file is File && file.path.endsWith('.dart'))
+ .forEach((File file) {
+ test(file.path, () {
+ var source = new StringBuffer();
+ file
+ .openRead()
+ .transform(SYSTEM_ENCODING.decoder)
+ .listen((part) => source.write(part), onDone: expectAsync(() {
+ expect(source.toString(), accept(dart));
+ }), onError: fail);
+ });
+ });
+ });
+}
+
+void main() {
+ var dart = new DartGrammar();
+ generateTests(dart, 'Dart SDK', new Directory('packages')
+ .listSync(recursive: true, followLinks: false));
+ generateTests(dart, 'PetitParser', Directory.current
+ .listSync(recursive: true, followLinks: true));
+}
« no previous file with comments | « packages/petitparser/test/core_benchmark.dart ('k') | packages/petitparser/test/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698