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

Unified Diff: pkg/analyzer/test/generated/source_factory_test.dart

Issue 1212533002: Test cleanup. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/source_factory_test.dart
diff --git a/pkg/analyzer/test/generated/source_factory_test.dart b/pkg/analyzer/test/generated/source_factory_test.dart
index 67ec71e185f598af43076240826d4f26f7a18da8..26b3942c1c0fb47e08e9f7cfeb446ee0ee530d43 100644
--- a/pkg/analyzer/test/generated/source_factory_test.dart
+++ b/pkg/analyzer/test/generated/source_factory_test.dart
@@ -31,32 +31,33 @@ class SourceFactoryTest {
void test_creation() {
expect(new SourceFactory([]), isNotNull);
}
+
void test_fromEncoding_invalidUri() {
SourceFactory factory = new SourceFactory([]);
- try {
- factory.fromEncoding("<:&%>");
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {}
+ expect(() => factory.fromEncoding("<:&%>"),
+ throwsA(new isInstanceOf<IllegalArgumentException>()));
}
+
void test_fromEncoding_noResolver() {
SourceFactory factory = new SourceFactory([]);
- try {
- factory.fromEncoding("foo:/does/not/exist.dart");
- fail("Expected IllegalArgumentException");
- } on IllegalArgumentException {}
+ expect(() => factory.fromEncoding("foo:/does/not/exist.dart"),
+ throwsA(new isInstanceOf<IllegalArgumentException>()));
}
+
void test_fromEncoding_valid() {
String encoding = "file:///does/not/exist.dart";
SourceFactory factory = new SourceFactory(
[new UriResolver_SourceFactoryTest_test_fromEncoding_valid(encoding)]);
expect(factory.fromEncoding(encoding), isNotNull);
}
+
void test_resolveUri_absolute() {
UriResolver_absolute resolver = new UriResolver_absolute();
SourceFactory factory = new SourceFactory([resolver]);
factory.resolveUri(null, "dart:core");
expect(resolver.invoked, isTrue);
}
+
void test_resolveUri_nonAbsolute_absolute() {
SourceFactory factory =
new SourceFactory([new UriResolver_nonAbsolute_absolute()]);
@@ -67,6 +68,7 @@ class SourceFactoryTest {
expect(result.fullName,
FileUtilities2.createFile(absolutePath).getAbsolutePath());
}
+
void test_resolveUri_nonAbsolute_relative() {
SourceFactory factory =
new SourceFactory([new UriResolver_nonAbsolute_relative()]);
@@ -146,9 +148,7 @@ class UriResolver_nonAbsolute_relative extends UriResolver {
class UriResolver_restoreUri extends UriResolver {
Source source1;
-
Uri expected1;
-
UriResolver_restoreUri(this.source1, this.expected1);
@override
@@ -166,7 +166,6 @@ class UriResolver_restoreUri extends UriResolver {
class UriResolver_SourceFactoryTest_test_fromEncoding_valid
extends UriResolver {
String encoding;
-
UriResolver_SourceFactoryTest_test_fromEncoding_valid(this.encoding);
@override
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698