Skip to content
Snippets Groups Projects
Commit 2298436d authored by nweiz@google.com's avatar nweiz@google.com
Browse files

pub: treat a pubspec with just comments as empty

BUG= http://dartbug.com/3483

TEST=

Review URL: https://chromiumcodereview.appspot.com//10534081
Patch from Kevin Moore <kevmoo@j832.com>.

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@9686 260f80e4-7a28-3924-810f-c04153c831b5
parent b1640759
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,8 @@ class Pubspec {
if (contents.trim() == '') return new Pubspec.empty();
var parsedPubspec = loadYaml(contents);
if (parsedPubspec == null) return new Pubspec.empty();
if (parsedPubspec is! Map) {
throw new FormatException('The pubspec must be a YAML mapping.');
}
......
......@@ -53,6 +53,20 @@ dependencies:
''', sources);
});
});
test("allows comment-only files", () {
var sources = new SourceRegistry();
sources.register(new MockSource());
var pubspec = new Pubspec.parse('''
# No external dependencies yet
# Including for completeness
# ...and hoping the spec expands to include details about author, version, etc
# See http://www.dartlang.org/docs/pub-package-manager/ for details
''', sources);
expect(pubspec.version, equals(Version.none));
expect(pubspec.dependencies, isEmpty);
});
});
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment