| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:barback/barback.dart'; | 6 import 'package:barback/barback.dart'; |
| 7 import 'package:observe/transform.dart'; | 7 import 'package:observe/transform.dart'; |
| 8 import 'package:unittest/compact_vm_config.dart'; | 8 import 'package:unittest/compact_vm_config.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 expect(transform.outs, hasLength(1)); | 117 expect(transform.outs, hasLength(1)); |
| 118 expect(transform.outs[0].id, id); | 118 expect(transform.outs[0].id, id); |
| 119 return transform.outs.first.readAsString(); | 119 return transform.outs.first.readAsString(); |
| 120 }); | 120 }); |
| 121 }); | 121 }); |
| 122 } | 122 } |
| 123 | 123 |
| 124 class _MockTransform implements Transform { | 124 class _MockTransform implements Transform { |
| 125 List<Asset> outs = []; | 125 List<Asset> outs = []; |
| 126 Asset _asset; | 126 Asset _asset; |
| 127 TransformLogger logger = new TransformLogger(false); | 127 TransformLogger logger = new TransformLogger(_mockLogFn); |
| 128 Asset get primaryInput => _asset; | 128 Asset get primaryInput => _asset; |
| 129 | 129 |
| 130 _MockTransform(this._asset); | 130 _MockTransform(this._asset); |
| 131 Future<Asset> getInput(AssetId id) { | 131 Future<Asset> getInput(AssetId id) { |
| 132 if (id == primaryInput.id) return new Future.value(primaryInput); | 132 if (id == primaryInput.id) return new Future.value(primaryInput); |
| 133 fail('_MockTransform fail'); | 133 fail('_MockTransform fail'); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void addOutput(Asset output) { | 136 void addOutput(Asset output) { |
| 137 outs.add(output); | 137 outs.add(output); |
| 138 } | 138 } |
| 139 | 139 |
| 140 readInput(id) => throw new UnimplementedError(); | 140 readInput(id) => throw new UnimplementedError(); |
| 141 readInputAsString(id, {encoding}) => throw new UnimplementedError(); | 141 readInputAsString(id, {encoding}) => throw new UnimplementedError(); |
| 142 |
| 143 static void _mockLogFn(AssetId asset, LogLevel level, String message, |
| 144 Span span) { |
| 145 // Do nothing. |
| 146 } |
| 142 } | 147 } |
| 143 | 148 |
| 144 String _sampleObservable(String annotation) => ''' | 149 String _sampleObservable(String annotation) => ''' |
| 145 library A_foo; | 150 library A_foo; |
| 146 import 'package:observe/observe.dart'; | 151 import 'package:observe/observe.dart'; |
| 147 | 152 |
| 148 class A extends ObservableBase { | 153 class A extends ObservableBase { |
| 149 @$annotation int foo; | 154 @$annotation int foo; |
| 150 A(this.foo); | 155 A(this.foo); |
| 151 } | 156 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 182 " Foo\n" | 187 " Foo\n" |
| 183 " get foo => __\$foo; Foo __\$foo/*D*/= 1; " | 188 " get foo => __\$foo; Foo __\$foo/*D*/= 1; " |
| 184 "${_makeSetter('Foo', 'foo')} " | 189 "${_makeSetter('Foo', 'foo')} " |
| 185 "@$annotation @otherMetadata Foo get bar => __\$bar; " | 190 "@$annotation @otherMetadata Foo get bar => __\$bar; " |
| 186 "Foo __\$bar =/*A*/2/*B*/; ${_makeSetter('Foo', 'bar')}\n" | 191 "Foo __\$bar =/*A*/2/*B*/; ${_makeSetter('Foo', 'bar')}\n" |
| 187 " @$annotation @otherMetadata Foo get quux => __\$quux; " | 192 " @$annotation @otherMetadata Foo get quux => __\$quux; " |
| 188 "Foo __\$quux/*C*/; ${_makeSetter('Foo', 'quux')}\n\n" | 193 "Foo __\$quux/*C*/; ${_makeSetter('Foo', 'quux')}\n\n" |
| 189 " @$annotation dynamic get baz => __\$baz; dynamic __\$baz; " | 194 " @$annotation dynamic get baz => __\$baz; dynamic __\$baz; " |
| 190 "${_makeSetter('dynamic', 'baz')}\n" | 195 "${_makeSetter('dynamic', 'baz')}\n" |
| 191 "}\n"; | 196 "}\n"; |
| OLD | NEW |