| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 library smoke.test.codegen.common; | |
| 6 | |
| 7 import 'package:smoke/codegen/generator.dart'; | |
| 8 import 'package:test/test.dart'; | |
| 9 | |
| 10 checkResults(SmokeCodeGenerator generator, | |
| 11 {List<String> imports: const [], String topLevel: '', String initCall}) { | |
| 12 var allImports = [] | |
| 13 ..addAll(DEFAULT_IMPORTS) | |
| 14 ..addAll(imports) | |
| 15 ..add(''); | |
| 16 var genImports = new StringBuffer(); | |
| 17 generator.writeImports(genImports); | |
| 18 expect(genImports.toString(), allImports.join('\n')); | |
| 19 | |
| 20 var genTopLevel = new StringBuffer(); | |
| 21 generator.writeTopLevelDeclarations(genTopLevel); | |
| 22 expect(genTopLevel.toString(), topLevel); | |
| 23 | |
| 24 var indentedCode = initCall.replaceAll("\n", "\n ").trim(); | |
| 25 var genInitCall = new StringBuffer(); | |
| 26 genInitCall.write(' useGeneratedCode('); | |
| 27 generator.writeStaticConfiguration(genInitCall); | |
| 28 genInitCall.writeln(');'); | |
| 29 expect(genInitCall.toString(), ' $indentedCode\n'); | |
| 30 } | |
| OLD | NEW |