| OLD | NEW |
| (Empty) | |
| 1 @TestOn('vm') |
| 2 library samples_test; |
| 3 |
| 4 import 'dart:io'; |
| 5 import 'dart:mirrors'; |
| 6 |
| 7 import 'package:test/test.dart'; |
| 8 import 'package:csslib/parser.dart'; |
| 9 |
| 10 const testOptions = const PreprocessorOptions( |
| 11 useColors: false, |
| 12 checked: false, |
| 13 warningsAsErrors: true, |
| 14 inputFile: 'memory'); |
| 15 |
| 16 void testCSSFile(File cssFile) { |
| 17 final errors = <Message>[]; |
| 18 final css = cssFile.readAsStringSync(); |
| 19 final stylesheet = parse(css, errors: errors, options: testOptions); |
| 20 |
| 21 expect(stylesheet, isNotNull); |
| 22 expect(errors, isEmpty, reason: errors.toString()); |
| 23 } |
| 24 |
| 25 main() { |
| 26 final libraryUri = currentMirrorSystem().findLibrary(#samples_test).uri; |
| 27 final cssDir = new Directory.fromUri(libraryUri.resolve('examples')); |
| 28 for (var element in cssDir.listSync()) |
| 29 if (element is File && element.uri.pathSegments.last.endsWith('.css')) { |
| 30 test(element.uri.pathSegments.last, () => testCSSFile(element)); |
| 31 } |
| 32 } |
| OLD | NEW |