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

Side by Side Diff: pkg/csslib/test/testing.dart

Issue 60983003: pkg/csslib: fixed analysis error, more cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 7 years, 1 month 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/csslib/lib/visitor.dart ('k') | no next file » | 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) 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 'package:csslib/parser.dart'; 8 import 'package:csslib/parser.dart';
9 import 'package:csslib/visitor.dart'; 9 import 'package:csslib/visitor.dart';
10 import 'package:csslib/src/messages.dart'; 10 import 'package:csslib/src/messages.dart';
11 11
12 void useMockMessages() { 12 void useMockMessages() {
13 messages = new Messages(printHandler: (message) {}); 13 messages = new Messages(printHandler: (message) {});
14 } 14 }
15 15
16 /** 16 /**
17 * Spin-up CSS parser in checked mode to detect any problematic CSS. Normally, 17 * Spin-up CSS parser in checked mode to detect any problematic CSS. Normally,
18 * CSS will allow any property/value pairs regardless of validity; all of our 18 * CSS will allow any property/value pairs regardless of validity; all of our
19 * tests (by default) will ensure that the CSS is really valid. 19 * tests (by default) will ensure that the CSS is really valid.
20 */ 20 */
21 StyleSheet parseCss(String cssInput, {List errors, List opts}) => 21 StyleSheet parseCss(String cssInput, {List<Message> errors,
22 List<String> opts}) =>
22 parse(cssInput, errors: errors, options: opts == null ? 23 parse(cssInput, errors: errors, options: opts == null ?
23 ['--no-colors', '--checked', '--warnings_as_errors', 'memory'] : opts); 24 ['--no-colors', '--checked', '--warnings_as_errors', 'memory'] : opts);
24 25
25 /** 26 /**
26 * Spin-up CSS parser in checked mode to detect any problematic CSS. Normally, 27 * Spin-up CSS parser in checked mode to detect any problematic CSS. Normally,
27 * CSS will allow any property/value pairs regardless of validity; all of our 28 * CSS will allow any property/value pairs regardless of validity; all of our
28 * tests (by default) will ensure that the CSS is really valid. 29 * tests (by default) will ensure that the CSS is really valid.
29 */ 30 */
30 StyleSheet compileCss(String cssInput, {List errors, List opts, 31 StyleSheet compileCss(String cssInput, {List<Message> errors, List<String> opts,
31 bool polyfill: false, List<StyleSheet> includes: null}) => 32 bool polyfill: false, List<StyleSheet> includes: null}) =>
32 compile(cssInput, errors: errors, options: opts == null ? 33 compile(cssInput, errors: errors, options: opts == null ?
33 ['--no-colors', '--checked', '--warnings_as_errors', 'memory'] : opts, 34 ['--no-colors', '--checked', '--warnings_as_errors', 'memory'] : opts,
34 polyfill: polyfill, includes: includes); 35 polyfill: polyfill, includes: includes);
35 36
36 StyleSheet polyFillCompileCss(input, {List errors, List opts}) => 37 StyleSheet polyFillCompileCss(input, {List<Message> errors,
38 List<String> opts}) =>
37 compileCss(input, errors: errors, polyfill: true, opts: opts); 39 compileCss(input, errors: errors, polyfill: true, opts: opts);
38 40
39 /** CSS emitter walks the style sheet tree and emits readable CSS. */ 41 /** CSS emitter walks the style sheet tree and emits readable CSS. */
40 final _emitCss = new CssPrinter(); 42 final _emitCss = new CssPrinter();
41 43
42 /** Simple Visitor does nothing but walk tree. */ 44 /** Simple Visitor does nothing but walk tree. */
43 final _cssVisitor = new Visitor(); 45 final _cssVisitor = new Visitor();
44 46
45 /** Pretty printer for CSS. */ 47 /** Pretty printer for CSS. */
46 String prettyPrint(StyleSheet ss) { 48 String prettyPrint(StyleSheet ss) {
(...skipping 11 matching lines...) Expand all
58 walkTree(ss); 60 walkTree(ss);
59 return (_emitCss..visitTree(ss, pretty: false)).toString(); 61 return (_emitCss..visitTree(ss, pretty: false)).toString();
60 } 62 }
61 63
62 /** Walks the style sheet tree does nothing; insures the basic walker works. */ 64 /** Walks the style sheet tree does nothing; insures the basic walker works. */
63 void walkTree(StyleSheet ss) { 65 void walkTree(StyleSheet ss) {
64 _cssVisitor..visitTree(ss); 66 _cssVisitor..visitTree(ss);
65 } 67 }
66 68
67 String dumpTree(StyleSheet ss) => treeToDebugString(ss); 69 String dumpTree(StyleSheet ss) => treeToDebugString(ss);
OLDNEW
« no previous file with comments | « pkg/csslib/lib/visitor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698