| OLD | NEW |
| 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 Loading... |
| 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 ]; |
| OLD | NEW |