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

Unified Diff: pkg/analysis_server/test/resource_test.dart

Issue 300853006: Tests for exceptional situations in MemoryResourceProvider. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/analysis_server/lib/src/resource.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/resource_test.dart
diff --git a/pkg/analysis_server/test/resource_test.dart b/pkg/analysis_server/test/resource_test.dart
index 4818dc6e3289cfc0cdd2c522f9aae79f39aeb18a..52899f4850c30dbc3a05565bc9b104c2b2806e58 100644
--- a/pkg/analysis_server/test/resource_test.dart
+++ b/pkg/analysis_server/test/resource_test.dart
@@ -22,6 +22,52 @@ main() {
provider = new MemoryResourceProvider();
});
+ test('MemoryResourceException', () {
+ var exception = new MemoryResourceException('/my/path', 'my message');
+ expect(exception.path, '/my/path');
+ expect(exception.message, 'my message');
+ expect(exception.toString(),
+ 'MemoryResourceException(path=/my/path; message=my message)');
+ });
+
+ group('newFolder', () {
+ test('empty path', () {
+ expect(
+ () {
+ provider.newFolder('');
+ },
+ throwsA(new isInstanceOf<ArgumentError>())
+ );
+ });
+
+ test('not absolute', () {
+ expect(
+ () {
+ provider.newFolder('not/absolute');
+ },
+ throwsA(new isInstanceOf<ArgumentError>())
+ );
+ });
+
+ group('already exists', () {
+ test('as folder', () {
+ Folder folder = provider.newFolder('/my/folder');
+ Folder newFolder = provider.newFolder('/my/folder');
+ expect(newFolder, folder);
+ });
+
+ test('as file', () {
Brian Wilkerson 2014/05/27 19:32:26 Is it worth testing the creation of a file when a
+ File file = provider.newFile('/my/file', 'qwerty');
+ expect(
+ () {
+ provider.newFolder('/my/file');
+ },
+ throwsA(new isInstanceOf<ArgumentError>())
+ );
+ });
+ });
+ });
+
group('File', () {
group('==', () {
test('false', () {
« no previous file with comments | « pkg/analysis_server/lib/src/resource.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698