| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.test.generated.test.generated.source_factory; | 5 library analyzer.test.generated.test.generated.source_factory; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 @reflectiveTest | 232 @reflectiveTest |
| 233 class SourceFactoryTest { | 233 class SourceFactoryTest { |
| 234 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); | 234 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); |
| 235 | 235 |
| 236 void test_creation() { | 236 void test_creation() { |
| 237 expect(new SourceFactory([]), isNotNull); | 237 expect(new SourceFactory([]), isNotNull); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void test_fromEncoding_invalidUri() { | 240 void test_fromEncoding_invalidUri() { |
| 241 SourceFactory factory = new SourceFactory([]); | 241 SourceFactory factory = new SourceFactory([]); |
| 242 expect(() => factory.fromEncoding("<:&%>"), | 242 expect(() => factory.fromEncoding("<:&%>"), throwsArgumentError); |
| 243 throwsA(new isInstanceOf<IllegalArgumentException>())); | |
| 244 } | 243 } |
| 245 | 244 |
| 246 void test_fromEncoding_noResolver() { | 245 void test_fromEncoding_noResolver() { |
| 247 SourceFactory factory = new SourceFactory([]); | 246 SourceFactory factory = new SourceFactory([]); |
| 248 expect(() => factory.fromEncoding("foo:/does/not/exist.dart"), | 247 expect(() => factory.fromEncoding("foo:/does/not/exist.dart"), |
| 249 throwsA(new isInstanceOf<IllegalArgumentException>())); | 248 throwsArgumentError); |
| 250 } | 249 } |
| 251 | 250 |
| 252 void test_fromEncoding_valid() { | 251 void test_fromEncoding_valid() { |
| 253 String encoding = "file:///does/not/exist.dart"; | 252 String encoding = "file:///does/not/exist.dart"; |
| 254 SourceFactory factory = new SourceFactory( | 253 SourceFactory factory = new SourceFactory( |
| 255 [new UriResolver_SourceFactoryTest_test_fromEncoding_valid(encoding)]); | 254 [new UriResolver_SourceFactoryTest_test_fromEncoding_valid(encoding)]); |
| 256 expect(factory.fromEncoding(encoding), isNotNull); | 255 expect(factory.fromEncoding(encoding), isNotNull); |
| 257 } | 256 } |
| 258 | 257 |
| 259 void test_resolveUri_absolute() { | 258 void test_resolveUri_absolute() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding); | 360 UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding); |
| 362 | 361 |
| 363 @override | 362 @override |
| 364 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 363 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 365 if (uri.toString() == encoding) { | 364 if (uri.toString() == encoding) { |
| 366 return new TestSource(); | 365 return new TestSource(); |
| 367 } | 366 } |
| 368 return null; | 367 return null; |
| 369 } | 368 } |
| 370 } | 369 } |
| OLD | NEW |