OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** Common definitions used for setting up the test environment. */ | 5 /** Common definitions used for setting up the test environment. */ |
6 library testing; | 6 library testing; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 for (var file in files) { | 57 for (var file in files) { |
58 var path = file.path; | 58 var path = file.path; |
59 result[path] = analyzeDefinitions(global, new UrlInfo(path, path, null), | 59 result[path] = analyzeDefinitions(global, new UrlInfo(path, path, null), |
60 file.document, packageRoot, messages); | 60 file.document, packageRoot, messages); |
61 } | 61 } |
62 | 62 |
63 // analyze file contents | 63 // analyze file contents |
64 var uniqueIds = new IntIterator(); | 64 var uniqueIds = new IntIterator(); |
65 var pseudoElements = new Map(); | 65 var pseudoElements = new Map(); |
66 for (var file in files) { | 66 for (var file in files) { |
67 analyzeFile(file, result, uniqueIds, pseudoElements, messages); | 67 analyzeFile(file, result, uniqueIds, pseudoElements, messages, true); |
68 } | 68 } |
69 return result; | 69 return result; |
70 } | 70 } |
71 | 71 |
72 Compiler createCompiler(Map files, Messages messages, {bool errors: false}) { | 72 Compiler createCompiler(Map files, Messages messages, {bool errors: false, |
| 73 bool scopedCss: false}) { |
73 List baseOptions = ['--no-colors', '-o', 'out', 'index.html']; | 74 List baseOptions = ['--no-colors', '-o', 'out', 'index.html']; |
74 if (errors) baseOptions.insert(0, '--warnings_as_errors'); | 75 if (errors) baseOptions.insert(0, '--warnings_as_errors'); |
| 76 if (scopedCss) baseOptions.insert(0, '--scoped-css'); |
75 var options = CompilerOptions.parse(baseOptions); | 77 var options = CompilerOptions.parse(baseOptions); |
76 var fs = new MockFileSystem(files); | 78 var fs = new MockFileSystem(files); |
77 return new Compiler(fs, options, messages); | 79 return new Compiler(fs, options, messages); |
78 } | 80 } |
79 | 81 |
80 String prettyPrintCss(StyleSheet styleSheet) => | 82 String prettyPrintCss(StyleSheet styleSheet) => |
81 ((new CssPrinter())..visitTree(styleSheet)).toString(); | 83 ((new CssPrinter())..visitTree(styleSheet)).toString(); |
82 | 84 |
83 /** | 85 /** |
84 * Abstraction around file system access to work in a variety of different | 86 * Abstraction around file system access to work in a variety of different |
(...skipping 15 matching lines...) Expand all Loading... |
100 } else { | 102 } else { |
101 return new Future.error( | 103 return new Future.error( |
102 new FileException('MockFileSystem: $path not found')); | 104 new FileException('MockFileSystem: $path not found')); |
103 } | 105 } |
104 } | 106 } |
105 | 107 |
106 // Compiler doesn't call these | 108 // Compiler doesn't call these |
107 void writeString(String outfile, String text) {} | 109 void writeString(String outfile, String text) {} |
108 Future flush() {} | 110 Future flush() {} |
109 } | 111 } |
OLD | NEW |