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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/docgen/lib/src/models/model_helpers.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library docgen.test.typedef; 5 library docgen.test.typedef;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 24 matching lines...) Expand all
35 35
36 // 36 //
37 // Validate function doc references 37 // Validate function doc references
38 // 38 //
39 var functionDef = 39 var functionDef =
40 testLibBar['functions']['methods']['positionalDefaultValues'] 40 testLibBar['functions']['methods']['positionalDefaultValues']
41 as Map<String, dynamic>; 41 as Map<String, dynamic>;
42 42
43 var params = functionDef['parameters'] as Map<String, dynamic>; 43 var params = functionDef['parameters'] as Map<String, dynamic>;
44 44
45 expect(params.keys, orderedEquals(_PARAM_NAME_ORDER),
46 reason: 'parameter order must be maintained');
47
45 var vals = {}; 48 var vals = {};
46 params.forEach((paramName, paramHash) { 49 params.forEach((paramName, paramHash) {
47 expect(_PARAM_VALUES, contains(paramName)); 50 expect(_PARAM_VALUES, contains(paramName));
48 expect(paramHash['value'], _PARAM_VALUES[paramName], 51 expect(paramHash['value'], _PARAM_VALUES[paramName],
49 reason: 'Value for $paramName should match expected'); 52 reason: 'Value for $paramName should match expected');
50 }); 53 });
51 }); 54 });
52 }); 55 });
53 } 56 }
54 57
55 final _PARAM_VALUES = { 58 final _PARAM_VALUES = {
59 "intConst": "42",
56 "boolConst": "true", 60 "boolConst": "true",
57 "intConst": "42",
58 "listConst": '[true, 42, "Shanna", null, 3.14, []]', 61 "listConst": '[true, 42, "Shanna", null, 3.14, []]',
62 "stringConst": "\"Shanna\"",
59 "mapConst": startsWith("Map"), 63 "mapConst": startsWith("Map"),
60 "emptyMap": '{}', 64 "emptyMap": '{}'
61 "stringConst": "\"Shanna\""
62 }; 65 };
66
67 const _PARAM_NAME_ORDER = const [
68 "intConst",
69 "boolConst",
70 "listConst",
71 "stringConst",
72 "mapConst",
73 "emptyMap"
74 ];
OLDNEW
« 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