| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 library indenting_writer_test; | 6 library indenting_writer_test; |
| 7 | 7 |
| 8 import 'package:protoc-plugin/protoc.dart'; | 8 import 'package:protoc_plugin/protoc.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| 11 void main() { | 11 void main() { |
| 12 test('testIndentingWriter', () { | 12 test('testIndentingWriter', () { |
| 13 String blockExpected = r'''class test{ | 13 String blockExpected = r'''class test{ |
| 14 body; | 14 body; |
| 15 } | 15 } |
| 16 '''; | 16 '''; |
| 17 | 17 |
| 18 var iob = new MemoryWriter(); | 18 var iob = new MemoryWriter(); |
| 19 var writer = new IndentingWriter(' ', iob); | 19 var writer = new IndentingWriter(' ', iob); |
| 20 writer.addBlock('class test{', '}', () { | 20 writer.addBlock('class test{', '}', () { |
| 21 writer.println('body;'); | 21 writer.println('body;'); |
| 22 }); | 22 }); |
| 23 expect(iob.toString(), blockExpected); | 23 expect(iob.toString(), blockExpected); |
| 24 }); | 24 }); |
| 25 } | 25 } |
| OLD | NEW |