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

Unified Diff: utils/tests/pub/yaml_test.dart

Issue 10886055: Add a friendly error message for using a tab as indentation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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
« utils/pub/yaml/parser.dart ('K') | « utils/pub/yaml/parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/yaml_test.dart
diff --git a/utils/tests/pub/yaml_test.dart b/utils/tests/pub/yaml_test.dart
index 8616f488012945c79a87db26ab7c82bc0a049f26..c8d7facddcd48c8be286ca21491e94483bc87bb4 100644
--- a/utils/tests/pub/yaml_test.dart
+++ b/utils/tests/pub/yaml_test.dart
@@ -70,6 +70,21 @@ main() {
});
});
+ group('has a friendly error message for', () {
+ test('using a tab as indentation', () {
+ Expect.throws(() => loadYaml('foo:\n\tbar'),
Bob Nystrom 2012/08/30 16:43:51 expect(() => loadYaml('foo:\n\tbar'), throwsA(
nweiz 2012/08/30 19:19:02 Done, although just "contains()" doesn't work here
+ (e) => e.toString().contains('\\t is not allowed as indentation'));
+ });
+
+ test('using a tab not as indentation', () {
+ Expect.throws(() => loadYaml('''
+ "foo
+ \tbar"
+ error'''),
+ (e) => !e.toString().contains('\\t is not allowed as indentation'));
Bob Nystrom 2012/08/30 16:43:51 Ditto. We're trying to phase out all uses of Expe
nweiz 2012/08/30 19:19:02 Done.
+ });
+ });
+
// The following tests are all taken directly from the YAML spec
// (http://www.yaml.org/spec/1.2/spec.html). Most of them are code examples
// that are directly included in the spec, but additional tests are derived
« utils/pub/yaml/parser.dart ('K') | « utils/pub/yaml/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698