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

Unified Diff: pkg/docgen/test/constant_argument_test.dart

Issue 285463002: pkg/docgen: ensure parameter maps keep their key order (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: make ordering opt-in at the right places 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/docgen/lib/src/models/model_helpers.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/test/constant_argument_test.dart
diff --git a/pkg/docgen/test/constant_argument_test.dart b/pkg/docgen/test/constant_argument_test.dart
index ca735f4781e98c4faa69cfa0c537039fff092dfe..6380fdd2df589e2f436d92171cf035e5b08008da 100644
--- a/pkg/docgen/test/constant_argument_test.dart
+++ b/pkg/docgen/test/constant_argument_test.dart
@@ -42,6 +42,9 @@ void main() {
var params = functionDef['parameters'] as Map<String, dynamic>;
+ expect(params.keys, orderedEquals(_PARAM_NAME_ORDER),
+ reason: 'parameter order must be maintained');
+
var vals = {};
params.forEach((paramName, paramHash) {
expect(_PARAM_VALUES, contains(paramName));
@@ -53,10 +56,19 @@ void main() {
}
final _PARAM_VALUES = {
- "boolConst": "true",
"intConst": "42",
+ "boolConst": "true",
"listConst": '[true, 42, "Shanna", null, 3.14, []]',
+ "stringConst": "\"Shanna\"",
"mapConst": startsWith("Map"),
- "emptyMap": '{}',
- "stringConst": "\"Shanna\""
+ "emptyMap": '{}'
};
+
+const _PARAM_NAME_ORDER = const [
+ "intConst",
+ "boolConst",
+ "listConst",
+ "stringConst",
+ "mapConst",
+ "emptyMap"
+];
« no previous file with comments | « pkg/docgen/lib/src/models/model_helpers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698